diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 35f145a..7e7e715 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -637,11 +637,13 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * @class FontMetrics - * @memberof PIXI.TextMetrics + * + * @typedef {object} FontMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private */ const canvas = document.createElement('canvas'); diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 35f145a..7e7e715 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -637,11 +637,13 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * @class FontMetrics - * @memberof PIXI.TextMetrics + * + * @typedef {object} FontMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private */ const canvas = document.createElement('canvas'); diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 09f4d73..dc81a35 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -37,9 +37,11 @@ }; /** - * A TextStyle Object decorates a Text Object. It can be shared between - * multiple Text objects. Changing the style will update all text objects using it. - * It can be generated [here](https://pixijs.io/pixi-text-style). + * A TextStyle Object contains information to decorate a Text objects. + * + * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. + * + * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). * * @class * @memberof PIXI diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 35f145a..7e7e715 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -637,11 +637,13 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * @class FontMetrics - * @memberof PIXI.TextMetrics + * + * @typedef {object} FontMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private */ const canvas = document.createElement('canvas'); diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 09f4d73..dc81a35 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -37,9 +37,11 @@ }; /** - * A TextStyle Object decorates a Text Object. It can be shared between - * multiple Text objects. Changing the style will update all text objects using it. - * It can be generated [here](https://pixijs.io/pixi-text-style). + * A TextStyle Object contains information to decorate a Text objects. + * + * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. + * + * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). * * @class * @memberof PIXI diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 8f10da3..8e39e78 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -4,19 +4,15 @@ /** * A Ticker class that runs an update loop that other objects listen to. - * This class is composed around listeners - * meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, - * e.g. When the ticker is started and the emitter has listeners. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. * * @class * @memberof PIXI */ export default class Ticker { - /** - * - */ constructor() { /** diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 35f145a..7e7e715 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -637,11 +637,13 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * @class FontMetrics - * @memberof PIXI.TextMetrics + * + * @typedef {object} FontMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private */ const canvas = document.createElement('canvas'); diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 09f4d73..dc81a35 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -37,9 +37,11 @@ }; /** - * A TextStyle Object decorates a Text Object. It can be shared between - * multiple Text objects. Changing the style will update all text objects using it. - * It can be generated [here](https://pixijs.io/pixi-text-style). + * A TextStyle Object contains information to decorate a Text objects. + * + * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. + * + * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). * * @class * @memberof PIXI diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 8f10da3..8e39e78 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -4,19 +4,15 @@ /** * A Ticker class that runs an update loop that other objects listen to. - * This class is composed around listeners - * meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, - * e.g. When the ticker is started and the emitter has listeners. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. * * @class * @memberof PIXI */ export default class Ticker { - /** - * - */ constructor() { /** diff --git a/packages/utils/src/index.js b/packages/utils/src/index.js index a46acc5..e3e08de 100644 --- a/packages/utils/src/index.js +++ b/packages/utils/src/index.js @@ -18,6 +18,8 @@ */ /** + * A simple JS library that detects mobile devices + * * @see {@link https://github.com/kaimallea/isMobile} * * @memberof PIXI.utils @@ -28,6 +30,8 @@ export { isMobile }; /** + * Remove items from a javascript array without generating garbage + * * @see {@link https://github.com/mreinstein/remove-array-items} * * @memberof PIXI.utils @@ -38,6 +42,8 @@ export { removeItems }; /** + * A high performance event emitter + * * @see {@link https://github.com/primus/eventemitter3} * * @memberof PIXI.utils @@ -54,6 +60,8 @@ export { mixins }; /** + * A polygon triangulation library + * * @see {@link https://github.com/mapbox/earcut} * * @memberof PIXI.utils diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index b8cdde5..8ed75ab 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -22,14 +22,13 @@ const DIV_HOOK_ZINDEX = 2; /** - * The Accessibility manager recreates the ability to tab and have content read by screen - * readers. This is very important as it can possibly help people with disabilities access pixi - * content. + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. * - * Much like interaction any DisplayObject can be made accessible. This manager will map the + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the * events as if the mouse was being used, minimizing the effort required to implement. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.accessibility + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class * @memberof PIXI.accessibility @@ -186,8 +185,8 @@ } /** - * Activating will cause the Accessibility layer to be shown. This is called when a user - * presses the tab key. + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. * * @private */ @@ -212,8 +211,8 @@ } /** - * Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves - * the mouse. + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. * * @private */ @@ -360,9 +359,9 @@ } /** - * TODO: docs. + * Adjust the hit area based on the bounds of a display object * - * @param {Rectangle} hitArea - TODO docs + * @param {Rectangle} hitArea - Bounds of the child */ capHitArea(hitArea) { diff --git a/packages/accessibility/src/index.js b/packages/accessibility/src/index.js index 6e67d3a..706ef66 100644 --- a/packages/accessibility/src/index.js +++ b/packages/accessibility/src/index.js @@ -1,6 +1,5 @@ /** - * This namespace contains a renderer plugin for interaction accessibility for end-users - * with physical impairments which require screen-renders, keyboard navigation, etc. + * This namespace contains an accessibility plugin for allowing interaction via the keyboard. * * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. diff --git a/packages/app/src/Application.js b/packages/app/src/Application.js index 035918d..eb447be 100644 --- a/packages/app/src/Application.js +++ b/packages/app/src/Application.js @@ -4,8 +4,8 @@ /** * Convenience class to create a new PIXI application. - * This class automatically creates the renderer, ticker - * and root container. + * + * This class automatically creates the renderer, ticker and root container. * * @example * // Create the application @@ -22,7 +22,6 @@ */ export default class Application { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters. * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. diff --git a/packages/canvas/canvas-extract/src/CanvasExtract.js b/packages/canvas/canvas-extract/src/CanvasExtract.js index f42928e..bd11c1c 100644 --- a/packages/canvas/canvas-extract/src/CanvasExtract.js +++ b/packages/canvas/canvas-extract/src/CanvasExtract.js @@ -7,7 +7,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/canvas/canvas-mesh/src/index.js b/packages/canvas/canvas-mesh/src/index.js index 6926e31..27f3c2f 100644 --- a/packages/canvas/canvas-mesh/src/index.js +++ b/packages/canvas/canvas-mesh/src/index.js @@ -1,6 +1,7 @@ export { default as CanvasMeshRenderer } from './CanvasMeshRenderer'; import './settings'; + import './MeshMaterial'; import './NineSlicePlane'; import './Mesh'; diff --git a/packages/canvas/canvas-prepare/src/CanvasPrepare.js b/packages/canvas/canvas-prepare/src/CanvasPrepare.js index 44ff678..1ea6f48 100644 --- a/packages/canvas/canvas-prepare/src/CanvasPrepare.js +++ b/packages/canvas/canvas-prepare/src/CanvasPrepare.js @@ -4,12 +4,12 @@ const CANVAS_START_SIZE = 16; /** - * The prepare manager provides functionality to upload content to the GPU - * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing - * textures to an offline canvas. - * This draw call will force the texture to be moved onto the GPU. + * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing + * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/canvas/canvas-renderer/src/CanvasRenderer.js b/packages/canvas/canvas-renderer/src/CanvasRenderer.js index 40f1ed8..61a9273 100644 --- a/packages/canvas/canvas-renderer/src/CanvasRenderer.js +++ b/packages/canvas/canvas-renderer/src/CanvasRenderer.js @@ -6,9 +6,10 @@ import { settings } from '@pixi/settings'; /** - * The CanvasRenderer draws the scene and all its content onto a 2d canvas. This renderer should - * be used for browsers that do not support WebGL. Don't forget to add the CanvasRenderer.view to - * your DOM or you will not see anything :) + * The CanvasRenderer draws the scene and all its content onto a 2d canvas. + * + * This renderer should be used for browsers that do not support WebGL. + * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -16,7 +17,6 @@ */ export default class CanvasRenderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** * @param {object} [options] - The optional renderer parameters * @param {number} [options.width=800] - the width of the screen diff --git a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js index 22bc1a8..de4372d 100644 --- a/packages/canvas/canvas-renderer/src/autoDetectRenderer.js +++ b/packages/canvas/canvas-renderer/src/autoDetectRenderer.js @@ -2,10 +2,9 @@ import { Renderer } from '@pixi/core'; import CanvasRenderer from './CanvasRenderer'; -// eslint-disable-next-line valid-jsdoc /** * This helper function will automatically detect which renderer you should be using. - * WebGL is the preferred renderer as it is a lot faster. If webGL is not supported by + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by * the browser then this function will return a canvas renderer * * @memberof PIXI diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index fe2744d..b99f862 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -3,6 +3,8 @@ /** * A set of functions used to handle masking. * + * Sprite masking is not supported on the CanvasRenderer. + * * @class * @memberof PIXI */ diff --git a/packages/canvas/canvas-sprite/src/CanvasTinter.js b/packages/canvas/canvas-sprite/src/CanvasTinter.js index 5b30162..98c72e9 100644 --- a/packages/canvas/canvas-sprite/src/CanvasTinter.js +++ b/packages/canvas/canvas-sprite/src/CanvasTinter.js @@ -4,6 +4,9 @@ /** * Utility methods for Sprite/Texture tinting. * + * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture, + * so be aware of the performance implications. + * * @class * @memberof PIXI */ diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4144b38..366f4a3 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -211,7 +211,7 @@ * * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. - * If the texture is non power of two then clamp will be used regardless as webGL can + * If the texture is non power of two then clamp will be used regardless as WebGL can * only use REPEAT if the texture is po2. * * This property only affects WebGL. diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index b814140..22ebcc3 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -19,7 +19,6 @@ */ export default class AbstractRenderer extends EventEmitter { - // eslint-disable-next-line valid-jsdoc /** * @param {string} system - The name of the system this renderer is for. * @param {object} [options] - The optional renderer parameters. diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a668120..766146f 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -19,10 +19,12 @@ import Runner from 'mini-runner'; /** - * The Renderer draws the scene and all its content onto a WebGL enabled canvas. This renderer - * should be used for browsers that support WebGL. This renderer works by automatically managing WebGLBatches. - * So no need for Sprite Batches or Sprite Clouds. - * Don't forget to add the view to your DOM or you will not see anything :). + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! * * @class * @memberof PIXI @@ -30,9 +32,7 @@ */ export default class Renderer extends AbstractRenderer { - // eslint-disable-next-line valid-jsdoc /** - * * @param {object} [options] - The optional renderer parameters. * @param {number} [options.width=800] - The width of the screen. * @param {number} [options.height=600] - The height of the screen. @@ -196,6 +196,7 @@ * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') + /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch diff --git a/packages/core/src/System.js b/packages/core/src/System.js index 2b98310..c38d5af 100644 --- a/packages/core/src/System.js +++ b/packages/core/src/System.js @@ -1,5 +1,6 @@ /** * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * * @see PIXI.Renderer#addSystem * @class * @memberof PIXI @@ -23,6 +24,7 @@ /** * Generic method called when there is a WebGL context change. + * * @param {WebGLRenderingContext} gl new webgl context */ contextChange(gl) // eslint-disable-line no-unused-vars @@ -32,7 +34,6 @@ /** * Generic destroy methods to be overridden by the subclass - * */ destroy() { diff --git a/packages/core/src/batch/BatchBuffer.js b/packages/core/src/batch/BatchBuffer.js index de3ba21..b80bc7e 100644 --- a/packages/core/src/batch/BatchBuffer.js +++ b/packages/core/src/batch/BatchBuffer.js @@ -1,4 +1,6 @@ /** + * Used by the BatchRenderer + * * @class * @memberof PIXI */ diff --git a/packages/core/src/batch/BatchDrawCall.js b/packages/core/src/batch/BatchDrawCall.js index 2d0a93b..9269188 100644 --- a/packages/core/src/batch/BatchDrawCall.js +++ b/packages/core/src/batch/BatchDrawCall.js @@ -1,6 +1,6 @@ /** - * Used by the batcher to draw batches - * each one of these contains all information required to draw a bound geometry. + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. * * @class * @memberof PIXI diff --git a/packages/core/src/batch/BatchGeometry.js b/packages/core/src/batch/BatchGeometry.js index 52f028a..6275f8c 100644 --- a/packages/core/src/batch/BatchGeometry.js +++ b/packages/core/src/batch/BatchGeometry.js @@ -3,7 +3,8 @@ import Buffer from '../geometry/Buffer'; /** - * Geometry used to batch standard PixiJS content (e.g., Mesh, Sprite, Graphics objects). + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * * @class * @memberof PIXI */ @@ -19,6 +20,7 @@ /** * Buffer used for position, color, texture IDs + * * @member {PIXI.Buffer} * @protected */ @@ -26,6 +28,7 @@ /** * Index buffer data + * * @member {PIXI.Buffer} * @protected */ diff --git a/packages/core/src/batch/BatchRenderer.js b/packages/core/src/batch/BatchRenderer.js index c6d7bd0..fba1642 100644 --- a/packages/core/src/batch/BatchRenderer.js +++ b/packages/core/src/batch/BatchRenderer.js @@ -255,7 +255,6 @@ let i; - // console.log("<>") for (i = 0; i < this.currentIndex; ++i) { // upload the sprite elements... @@ -402,7 +401,6 @@ const argb = alpha < 1.0 && element._texture.baseTexture.premultiplyAlpha ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // console.log(element._texture.baseTexture.premultiplyAlpha); // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { diff --git a/packages/core/src/batch/BatchSystem.js b/packages/core/src/batch/BatchSystem.js index c3d7015..2d1a8bf 100644 --- a/packages/core/src/batch/BatchSystem.js +++ b/packages/core/src/batch/BatchSystem.js @@ -2,6 +2,8 @@ import ObjectRenderer from './ObjectRenderer'; /** + * System plugin to the renderer to manage batching. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -9,7 +11,7 @@ export default class BatchSystem extends System { /** - * @param {PIXI.Renderer} renderer - The renderer this manager works for. + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -51,13 +53,15 @@ /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites - * */ flush() { this.setObjectRenderer(this.emptyRenderer); } + /** + * Reset the system to an empty renderer + */ reset() { this.setObjectRenderer(this.emptyRenderer); diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index bd6065b..dc6243d 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -5,6 +5,8 @@ let CONTEXT_UID = 0; /** + * System plugin to the renderer to manage the context. + * * @class * @extends PIXI.System * @memberof PIXI.systems @@ -100,7 +102,7 @@ } /** - * Helper class to create a webGL Context + * Helper class to create a WebGL Context * * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from * @param options {object} An options object that gets passed in to the canvas element containing the context attributes @@ -130,7 +132,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } @@ -148,7 +150,7 @@ */ getExtensions() { - // time to set up default extensions that pixi uses.. + // time to set up default extensions that Pixi uses. const { gl } = this; if (this.webGLVersion === 1) diff --git a/packages/core/src/filters/Filter.js b/packages/core/src/filters/Filter.js index 3a89a95..14b79ac 100644 --- a/packages/core/src/filters/Filter.js +++ b/packages/core/src/filters/Filter.js @@ -6,15 +6,16 @@ import defaultFragment from './defaultFilter.frag'; /** - * Filter is a special type of shader that is applied to the screen. + * Filter is a special type of WebGL shader that is applied to the screen. + * * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the * {@link PIXI.filters.BlurFilter BlurFilter}. * * ### Usage - * Filters can be applied to any DisplayObject or Container. PixiJS' `FilterSystem` - * 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. + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. * * ``` * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); @@ -26,12 +27,12 @@ * * In PixiJS **v3**, a filter was always applied to _whole screen_. * - * In PixiJS **v4**, a filter can be applied _only part of the screen_, developers - * had to create a set of uniforms to deal with coordinates. + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers 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 - * uniforms into account. + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. * * ### Built-in Uniforms * @@ -41,7 +42,7 @@ * **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 Framebuffers in PixiJS, both input and output are * premultiplied by alpha._ * * By default, input Framebuffer space coordinates are passed to fragment shader with `vTextureCoord`. @@ -127,12 +128,11 @@ * * ### Additional Information * - * Complete documentation on Filter usage is located in + * Complete documentation on Filter usage is located in the * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. * - * Since PixiJS only had a handful of built-in filters, additional filters - * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the - * PixiJS Filters repository. + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. * * @class * @memberof PIXI @@ -192,7 +192,7 @@ this.legacy = !!this.program.attributeData.aTextureCoord; /** - * the webGL state the filter requires to render + * The WebGL state the filter requires to render * @member {PIXI.State} */ this.state = new State(); diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index c59167f..6e6932d 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -10,7 +10,8 @@ import { DRAW_MODES } from '@pixi/constants'; /** - * Internal class to manage filter state + * System plugin to the renderer to manage filter states. + * * @class * @private */ @@ -84,7 +85,8 @@ const screenKey = 'screen'; /** - * Manage the rendering of filters within PixiJS + * System plugin to the renderer to manage the filters. + * * @class * @memberof PIXI.systems * @extends PIXI.System diff --git a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js index 8d3e4be..9ad91a9 100644 --- a/packages/core/src/filters/spriteMask/SpriteMaskFilter.js +++ b/packages/core/src/filters/spriteMask/SpriteMaskFilter.js @@ -5,7 +5,9 @@ import { default as TextureMatrix } from '../../textures/TextureMatrix'; /** - * The SpriteMaskFilter class + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. * * @class * @extends PIXI.Filter diff --git a/packages/core/src/framebuffer/Framebuffer.js b/packages/core/src/framebuffer/Framebuffer.js index 8613e22..ba285d3 100644 --- a/packages/core/src/framebuffer/Framebuffer.js +++ b/packages/core/src/framebuffer/Framebuffer.js @@ -2,12 +2,17 @@ import { FORMATS, TYPES } from '@pixi/constants'; /** - * Frame buffer + * Frame buffer used by the BaseRenderTexture + * * @class * @memberof PIXI */ export default class Framebuffer { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ constructor(width, height) { this.width = Math.ceil(width || 100); @@ -26,15 +31,27 @@ this.glFramebuffers = {}; } + /** + * Reference to the colorTexture. + * + * @member {PIXI.Texture[]} + * @readonly + */ get colorTexture() { return this.colorTextures[0]; } - addColorTexture(index, texture) + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.Texture} [texture] - Texture to add to the array + */ + addColorTexture(index = 0, texture) { // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index || 0] = texture || new Texture(null, { scaleMode: 0, + this.colorTextures[index] = texture || new Texture(null, { scaleMode: 0, resolution: 1, mipmap: false, width: this.width, @@ -46,6 +63,11 @@ return this; } + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.Texture} [texture] - Texture to add + */ addDepthTexture(texture) { /* eslint-disable max-len */ @@ -63,6 +85,9 @@ return this; } + /** + * Enable depth on the frame buffer + */ enableDepth() { this.depth = true; @@ -73,6 +98,9 @@ return this; } + /** + * Enable stencil on the frame buffer + */ enableStencil() { this.stencil = true; @@ -83,6 +111,12 @@ return this; } + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ resize(width, height) { width = Math.ceil(width); diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 4eaf536..e1885e6 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -4,7 +4,8 @@ import { settings } from '../settings'; /** - * Framebuffer system + * System plugin to the renderer to manage framebuffers. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 653c9e3..0603d9b 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -1,9 +1,10 @@ /* eslint-disable max-len */ /** - * holds the information for a single attribute structure required to render geometry. - * this does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} - * This can include anything from positions, uvs, normals, colors etc.. + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Buffer.js b/packages/core/src/geometry/Buffer.js index 926289b..f43c42a 100644 --- a/packages/core/src/geometry/Buffer.js +++ b/packages/core/src/geometry/Buffer.js @@ -2,7 +2,7 @@ /* eslint-disable max-len */ /** - * A wrapper for data so that it can be used and uploaded by webGL + * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 543f294..ed29751 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -19,10 +19,9 @@ /** * The Geometry represents a model. It consists of two components: - * GeometryStyle - The structure of the model such as the attributes layout - * GeometryData - the data of the model - this consists of buffers. - * - * This can include anything from positions, uvs, normals, colors etc.. + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. * * Geometry can be defined without passing in a style or data if required (thats how I prefer!) * diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index 3eaf193..a5b5cd3 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -6,6 +6,8 @@ const byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; /** + * System plugin to the renderer to manage geometry. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/MaskSystem.js b/packages/core/src/mask/MaskSystem.js index 9a88532..d25f682 100644 --- a/packages/core/src/mask/MaskSystem.js +++ b/packages/core/src/mask/MaskSystem.js @@ -2,6 +2,8 @@ import SpriteMaskFilter from '../filters/spriteMask/SpriteMaskFilter'; /** + * System plugin to the renderer to manage masks. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/mask/StencilSystem.js b/packages/core/src/mask/StencilSystem.js index 4c4856b..412662f 100644 --- a/packages/core/src/mask/StencilSystem.js +++ b/packages/core/src/mask/StencilSystem.js @@ -1,6 +1,8 @@ import System from '../System'; /** + * System plugin to the renderer to manage stencils (used for masks). + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/projection/ProjectionSystem.js b/packages/core/src/projection/ProjectionSystem.js index 3133e8d..fcafa61 100644 --- a/packages/core/src/projection/ProjectionSystem.js +++ b/packages/core/src/projection/ProjectionSystem.js @@ -2,6 +2,8 @@ import { Matrix } from '@pixi/math'; /** + * System plugin to the renderer to manage the projection matrix. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/renderTexture/RenderTextureSystem.js b/packages/core/src/renderTexture/RenderTextureSystem.js index 12e38dc..9004c76 100644 --- a/packages/core/src/renderTexture/RenderTextureSystem.js +++ b/packages/core/src/renderTexture/RenderTextureSystem.js @@ -4,6 +4,8 @@ const tempRect = new Rectangle(); /** + * System plugin to the renderer to manage render textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 2766621..efa9ee1 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -1,5 +1,5 @@ /** - * Helper class to create a webGL Program + * Helper class to create a WebGL Program * * @class * @memberof PIXI @@ -7,7 +7,8 @@ export default class GLProgram { /** - * makes new pixi program + * Makes a new Pixi program + * * @param program {WebGLProgram} webgl program * @param uniformData {Object} uniforms */ @@ -37,7 +38,6 @@ /** * Destroys this program - * TODO */ destroy() { diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index ebb2f95..25c7689 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -15,6 +15,8 @@ const nameCache = {}; /** + * Helper class to create a shader program. + * * @class * @memberof PIXI */ @@ -108,8 +110,8 @@ * returns the attribute data from the program * @private * - * @param {WebGLProgram} [program] - the webgl program - * @param {WebGLRenderingContext} [gl] - the webGL context + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context * * @returns {object} the attribute data for this program */ @@ -153,7 +155,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the webGL context + * @param {context} [gl] - the WebGL context * * @returns {object} the uniform data for this program */ @@ -220,7 +222,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, name) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 217029f..5e52e65 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -1,8 +1,9 @@ import Program from './Program'; import UniformGroup from './UniformGroup'; -// let math = require('../../../math'); /** + * A helper class for shaders + * * @class * @memberof PIXI */ @@ -94,7 +95,7 @@ * @param {string} [fragmentSrc] - The source of the fragment shader. * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. * - * @returns {PIXI.Shader} an shiny new pixi shader! + * @returns {PIXI.Shader} an shiny new Pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/packages/core/src/shader/ShaderSystem.js b/packages/core/src/shader/ShaderSystem.js index cec829c..b9e7b92 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -7,7 +7,7 @@ let UID = 0; /** - * Helper class to create a webGL Texture + * System plugin to the renderer to manage shaders. * * @class * @memberof PIXI.systems @@ -16,7 +16,7 @@ export default class ShaderSystem extends System { /** - * @param {PIXI.Renderer} renderer - A reference to the current renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { @@ -63,7 +63,7 @@ this.shader = shader; - // TODO - some current pixi plugins bypass this.. so it not safe to use yet.. + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. if (this.program !== program) { this.program = program; diff --git a/packages/core/src/shader/UniformGroup.js b/packages/core/src/shader/UniformGroup.js index d03ec5d..258e1c5 100644 --- a/packages/core/src/shader/UniformGroup.js +++ b/packages/core/src/shader/UniformGroup.js @@ -1,15 +1,14 @@ let UID = 0; -// let math = require('../../../math'); /** + * Uniform group holds uniform map and some ID's for work + * * @class * @memberof PIXI */ class UniformGroup { /** - * 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 */ @@ -21,6 +20,7 @@ * @readonly */ this.uniforms = uniforms; + /** * Its a group and not a single uniforms * @member {boolean} @@ -28,8 +28,10 @@ * @default true */ this.group = true; + // lets generate this when the shader ? this.syncUniforms = {}; + /** * dirty version * @protected diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 76b6ddb..e4d7749 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -224,8 +224,5 @@ } } - // console.log(' --------------- ') - // console.log(func); - return new Function('ud', 'uv', 'renderer', func); // eslint-disable-line no-new-func } diff --git a/packages/core/src/shader/utils/getTestContext.js b/packages/core/src/shader/utils/getTestContext.js index 7ff0fc0..bb40840 100644 --- a/packages/core/src/shader/utils/getTestContext.js +++ b/packages/core/src/shader/utils/getTestContext.js @@ -4,7 +4,7 @@ let context = null; /** - * returns a little webGL context to use for program inspection. + * returns a little WebGL context to use for program inspection. * * @static * @private @@ -31,7 +31,7 @@ if (!gl) { // fail, not able to get a context - throw new Error('This browser does not support webGL. Try using the canvas renderer'); + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } else { diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index c97faa7..6e5673d 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -7,8 +7,9 @@ const WINDING = 4; /** - * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh rendered may require webGL to be in a different state. + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. * For example you may want different blend mode or to enable polygon offsets * * @class @@ -16,9 +17,6 @@ */ export default class State { - /** - * - */ constructor() { this.data = 0; diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 9c71356..1870734 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -9,7 +9,7 @@ const WINDING = 4; /** - * A WebGL state machines + * System plugin to the renderer to manage WebGL state machines. * * @class * @extends PIXI.System @@ -18,7 +18,7 @@ export default class StateSystem extends System { /** - * @param {PIXI.Renderer} renderer - Reference to renderer + * @param {PIXI.Renderer} renderer - The renderer this System works for. */ constructor(renderer) { diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index 654a195..f31479d 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -15,7 +15,9 @@ }; /** - * A texture stores the information that represents an image. All textures have a base texture. + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture * * @class * @extends PIXI.utils.EventEmitter @@ -301,7 +303,7 @@ /** * Changes style options of BaseTexture * - * @param {PIXI.SCALE_MODES} [scaleMode] - pixi scalemode + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode * @param {boolean} [mipmap] - enable mipmaps * @returns {BaseTexture} this */ @@ -480,7 +482,7 @@ this.cacheId = null; } - // finally let the webGL renderer know.. + // finally let the WebGL renderer know.. this.dispose(); BaseTexture.removeFromCache(this); diff --git a/packages/core/src/textures/CubeTexture.js b/packages/core/src/textures/CubeTexture.js index 60f87e8..bd5f223 100644 --- a/packages/core/src/textures/CubeTexture.js +++ b/packages/core/src/textures/CubeTexture.js @@ -2,7 +2,7 @@ import CubeResource from './resources/CubeResource'; /** - * Texture that depends on six other resources. + * A Texture that depends on six other resources. * * @class * @extends PIXI.BaseTexture diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index 08b87e0..0878194 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -10,9 +10,10 @@ const DEFAULT_UVS = new TextureUvs(); /** - * A texture stores the information that represents an image or part of an image. It cannot be added - * to the display list directly. Instead use it as the texture for a Sprite. If no frame is provided - * then the whole image is used. + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. * * You can directly create a texture from an image and then reuse it multiple times like this : * @@ -98,7 +99,7 @@ this.valid = false; /** - * This will let a renderer know that a texture has been updated (used mainly for webGL uv updates) + * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) * * @member {boolean} */ @@ -357,12 +358,10 @@ */ static fromLoader(source, imageUrl, name) { - // console.log('added from loader...') const resource = new ImageResource(source); resource.url = imageUrl; - // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), diff --git a/packages/core/src/textures/TextureGCSystem.js b/packages/core/src/textures/TextureGCSystem.js index 90477ce..2ea8f9a 100644 --- a/packages/core/src/textures/TextureGCSystem.js +++ b/packages/core/src/textures/TextureGCSystem.js @@ -3,8 +3,8 @@ import { settings } from '@pixi/settings'; /** - * TextureGarbageCollector. This class manages the GPU and ensures that it does not get clogged - * up with textures that are no longer being used. + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. * * @class * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureMatrix.js b/packages/core/src/textures/TextureMatrix.js index 2af549d..50278b5 100644 --- a/packages/core/src/textures/TextureMatrix.js +++ b/packages/core/src/textures/TextureMatrix.js @@ -4,8 +4,8 @@ /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. - * Takes `trim` and `rotate` into account. - * May contain clamp settings for Meshes and TilingSprite. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. * * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. * If you want to add support for texture region of certain feature or filter, that's what you're looking for. diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 95cb141..1feb756 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -4,6 +4,8 @@ import { WRAP_MODES } from '@pixi/constants'; /** + * System plugin to the renderer to manage textures. + * * @class * @extends PIXI.System * @memberof PIXI.systems diff --git a/packages/core/src/textures/TextureUvs.js b/packages/core/src/textures/TextureUvs.js index 7ec353e..3186832 100644 --- a/packages/core/src/textures/TextureUvs.js +++ b/packages/core/src/textures/TextureUvs.js @@ -9,9 +9,6 @@ */ export default class TextureUvs { - /** - * - */ constructor() { this.x0 = 0; diff --git a/packages/core/src/textures/resources/ArrayResource.js b/packages/core/src/textures/resources/ArrayResource.js index f2b9039..f1c752e 100644 --- a/packages/core/src/textures/resources/ArrayResource.js +++ b/packages/core/src/textures/resources/ArrayResource.js @@ -4,7 +4,7 @@ import { autoDetectResource } from './autoDetectResource'; /** - * Resource for a CubeTexture which contains six resources. + * A resource that contains a number of sources. * * @class * @extends PIXI.resources.Resource diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index b8e082a..5abd9a7 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -39,6 +39,7 @@ /** * Add binding + * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ @@ -51,6 +52,7 @@ /** * Upload the resource + * * @returns {boolean} true is success */ upload(renderer, baseTexture, glTexture) @@ -81,6 +83,7 @@ /** * Number of texture sides to store for CubeResources + * * @name PIXI.resources.CubeResource.SIDES * @static * @member {number} diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 292ea48..6faf158 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -1,8 +1,10 @@ import Runner from 'mini-runner'; /** - * Base Texture resource class, manages validation and upload depends on its type. - * upload is required. + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * * @class * @memberof PIXI.resources */ diff --git a/packages/core/src/textures/resources/index.js b/packages/core/src/textures/resources/index.js index 75fc76b..b847ba1 100644 --- a/packages/core/src/textures/resources/index.js +++ b/packages/core/src/textures/resources/index.js @@ -9,6 +9,7 @@ /** * Collection of base resource types supported by PixiJS. + * * Resources are used by {@link PIXI.BaseTexture} to handle different media types * such as images, video, SVG graphics, etc. In most use-cases, you should not * instantiate the resources directly. The easy thing is to use diff --git a/packages/core/src/utils/Quad.js b/packages/core/src/utils/Quad.js index c861a1a..0c5eba3 100644 --- a/packages/core/src/utils/Quad.js +++ b/packages/core/src/utils/Quad.js @@ -8,9 +8,6 @@ */ export default class Quad extends Geometry { - /** - * just a quad - */ constructor() { super(); diff --git a/packages/display/src/Bounds.js b/packages/display/src/Bounds.js index 1fa9d4d..1172d1b 100644 --- a/packages/display/src/Bounds.js +++ b/packages/display/src/Bounds.js @@ -1,18 +1,16 @@ import { Rectangle } from '@pixi/math'; /** - * 'Builder' pattern for bounds rectangles - * Axis-Aligned Bounding Box - * It is not a shape! Its mutable thing, no 'EMPTY' or that kind of problems + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. * * @class * @memberof PIXI */ export default class Bounds { - /** - * - */ constructor() { /** diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 89552a0..b3c4447 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -14,7 +14,8 @@ /** * A Container represents a collection of display objects. - * It is the base class of all display objects that act as a container for other objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). * *```js * let container = new PIXI.Container(); @@ -27,9 +28,6 @@ */ export default class Container extends DisplayObject { - /** - * - */ constructor() { super(); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index b6c6974..20063cc 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -5,7 +5,8 @@ /** * The base class for all objects that are rendered on the screen. - * This is an abstract class and should not be used on its own rather it should be extended. + * + * This is an abstract class and should not be used on its own; rather it should be extended. * * @class * @extends PIXI.utils.EventEmitter @@ -13,9 +14,6 @@ */ export default class DisplayObject extends EventEmitter { - /** - * - */ constructor() { super(); @@ -98,7 +96,7 @@ * * Also works as an interaction mask. * - * @member {PIXI.Rectangle} + * @member {?PIXI.Rectangle} */ this.filterArea = null; @@ -107,7 +105,7 @@ * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * To remove filters simply set this property to `'null'`. * - * @member {PIXI.Filter[]} + * @member {?PIXI.Filter[]} */ this.filters = null; this._enabledFilters = null; @@ -640,7 +638,7 @@ /** * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PIXI a regular mask must be a + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it * utilities shape clipping. To remove a mask, set this property to `null`. * diff --git a/packages/extract/src/Extract.js b/packages/extract/src/Extract.js index 82f10b3..5244940 100644 --- a/packages/extract/src/Extract.js +++ b/packages/extract/src/Extract.js @@ -8,7 +8,7 @@ /** * The extract manager provides functionality to export content from the renderers. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.extract + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract` * * @class * @memberof PIXI.extract diff --git a/packages/filters/filter-alpha/src/AlphaFilter.js b/packages/filters/filter-alpha/src/AlphaFilter.js index 5fa8f1a..422e7bd 100644 --- a/packages/filters/filter-alpha/src/AlphaFilter.js +++ b/packages/filters/filter-alpha/src/AlphaFilter.js @@ -3,7 +3,7 @@ import fragment from './alpha.frag'; /** - * Simplest filter - applies alpha + * Simplest filter - applies alpha. * * Use this instead of Container's alpha property to avoid visual layering of individual elements. * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. diff --git a/packages/filters/filter-blur/src/BlurFilter.js b/packages/filters/filter-blur/src/BlurFilter.js index 4a4f87c..6837bd8 100644 --- a/packages/filters/filter-blur/src/BlurFilter.js +++ b/packages/filters/filter-blur/src/BlurFilter.js @@ -4,7 +4,8 @@ /** * The BlurFilter applies a Gaussian blur to an object. - * The strength of the blur can be set for x- and y-axis separately. + * + * The strength of the blur can be set for the x-axis and y-axis separately. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js index 1d30fbb..f18e199 100644 --- a/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js +++ b/packages/filters/filter-color-matrix/src/ColorMatrixFilter.js @@ -19,9 +19,6 @@ */ export default class ColorMatrixFilter extends Filter { - /** - * - */ constructor() { const uniforms = { diff --git a/packages/filters/filter-displacement/src/DisplacementFilter.js b/packages/filters/filter-displacement/src/DisplacementFilter.js index b998d92..7ea8e10 100644 --- a/packages/filters/filter-displacement/src/DisplacementFilter.js +++ b/packages/filters/filter-displacement/src/DisplacementFilter.js @@ -5,10 +5,11 @@ /** * The DisplacementFilter class uses the pixel values from the specified texture - * (called the displacement map) to perform a displacement of an object. You can - * use this filter to apply all manor of crazy warping effects. Currently the r - * property of the texture is used to offset the x and the g property of the texture - * is used to offset the y. + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. * * @class * @extends PIXI.Filter diff --git a/packages/filters/filter-fxaa/src/FXAAFilter.js b/packages/filters/filter-fxaa/src/FXAAFilter.js index 0c07dd5..0ac7d72 100644 --- a/packages/filters/filter-fxaa/src/FXAAFilter.js +++ b/packages/filters/filter-fxaa/src/FXAAFilter.js @@ -3,10 +3,8 @@ import fragment from './fxaa.frag'; /** - * - * Basic FXAA implementation based on the code on geeks3d.com with the - * modification that the texture2DLod stuff was removed since it's - * unsupported by WebGL. + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. * * @see https://github.com/mitsuhiko/webgl-meincraft * @@ -17,9 +15,6 @@ */ export default class FXAAFilter extends Filter { - /** - * - */ constructor() { // TODO - needs work diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index 572b3e4..4cf6c13 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -62,7 +62,7 @@ this.shader = null; /** - * Represents the webGL state the Graphics required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ @@ -734,7 +734,6 @@ } else { - // console.log('HOLE'); this.geometry.drawHole(shape, this._matrix); } @@ -1033,7 +1032,6 @@ let count = 0; - // console.log('.,', data.length); for (let i = 0; i < data.length; i += 2) { const x = data[i]; diff --git a/packages/graphics/src/GraphicsData.js b/packages/graphics/src/GraphicsData.js index f7b7628..ba550f1 100644 --- a/packages/graphics/src/GraphicsData.js +++ b/packages/graphics/src/GraphicsData.js @@ -1,5 +1,5 @@ /** - * A GraphicsData object. + * A class to contain data useful for Graphics objects * * @class * @memberof PIXI diff --git a/packages/graphics/src/GraphicsGeometry.js b/packages/graphics/src/GraphicsGeometry.js index 1a71049..1384f18 100644 --- a/packages/graphics/src/GraphicsGeometry.js +++ b/packages/graphics/src/GraphicsGeometry.js @@ -30,6 +30,7 @@ /** * A little internal structure to hold interim batch objects. + * * @private */ class BatchPart @@ -46,10 +47,10 @@ /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and - * rectangles to the display, and to color and fill them. GraphicsGeometry - * is designed to not be continually update the geometry since it's expensive - * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this - * use-case, it's much faster. + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. * * @class * @extends PIXI.BatchGeometry @@ -63,6 +64,7 @@ /** * An array of points to draw + * * @member {PIXI.Point[]} * @protected */ @@ -70,6 +72,7 @@ /** * The collection of colors + * * @member {number[]} * @protected */ @@ -77,6 +80,7 @@ /** * The UVs collection + * * @member {number[]} * @protected */ @@ -84,6 +88,7 @@ /** * The indices of the vertices + * * @member {number[]} * @protected */ @@ -91,6 +96,7 @@ /** * Reference to the texture IDs. + * * @member {number[]} * @protected */ @@ -138,7 +144,7 @@ this.cacheDirty = -1; /** - * Used to detect if we clear the graphics webGL data. + * Used to detect if we clear the graphics WebGL data. * * @member {number} * @default 0 diff --git a/packages/graphics/src/styles/FillStyle.js b/packages/graphics/src/styles/FillStyle.js index f8c31f7..7e6aca7 100644 --- a/packages/graphics/src/styles/FillStyle.js +++ b/packages/graphics/src/styles/FillStyle.js @@ -2,6 +2,7 @@ /** * Fill style object for Graphics. + * * @class * @memberof PIXI */ diff --git a/packages/graphics/src/utils/buildCircle.js b/packages/graphics/src/utils/buildCircle.js index 793b278..2630361 100644 --- a/packages/graphics/src/utils/buildCircle.js +++ b/packages/graphics/src/utils/buildCircle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index 59aeff2..9b64b6e 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -8,7 +8,7 @@ * @ignore * @private * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ export default function buildComplexPoly(graphicsData, webGLData) { diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 5ae3117..cda2ebc 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default function (graphicsData, graphicsGeometry) { @@ -31,7 +31,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildLine(graphicsData, graphicsGeometry) { @@ -241,7 +241,7 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape */ function buildNativeLine(graphicsData, graphicsGeometry) { diff --git a/packages/graphics/src/utils/buildPoly.js b/packages/graphics/src/utils/buildPoly.js index 8536b70..5b0d8fd 100644 --- a/packages/graphics/src/utils/buildPoly.js +++ b/packages/graphics/src/utils/buildPoly.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRectangle.js b/packages/graphics/src/utils/buildRectangle.js index c64c9e2..2a974d0 100644 --- a/packages/graphics/src/utils/buildRectangle.js +++ b/packages/graphics/src/utils/buildRectangle.js @@ -6,8 +6,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/graphics/src/utils/buildRoundedRectangle.js b/packages/graphics/src/utils/buildRoundedRectangle.js index d49a81e..356d450 100644 --- a/packages/graphics/src/utils/buildRoundedRectangle.js +++ b/packages/graphics/src/utils/buildRoundedRectangle.js @@ -8,8 +8,8 @@ * @ignore * @private * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the webGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the webGL-specific information to create nativeLines + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ export default { diff --git a/packages/interaction/src/InteractionData.js b/packages/interaction/src/InteractionData.js index e41df68..2433067 100644 --- a/packages/interaction/src/InteractionData.js +++ b/packages/interaction/src/InteractionData.js @@ -8,9 +8,6 @@ */ export default class InteractionData { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionEvent.js b/packages/interaction/src/InteractionEvent.js index c0bf491..59f602d 100644 --- a/packages/interaction/src/InteractionEvent.js +++ b/packages/interaction/src/InteractionEvent.js @@ -6,9 +6,6 @@ */ export default class InteractionEvent { - /** - * - */ constructor() { /** diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 73f8b3c..f8ba5e0 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -25,11 +25,13 @@ }; /** - * The interaction manager deals with mouse, touch and pointer events. Any DisplayObject can be interactive - * if its interactive parameter is set to true + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * * This manager also supports multitouch. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.interaction + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` * * @class * @extends PIXI.utils.EventEmitter diff --git a/packages/loaders/src/Loader.js b/packages/loaders/src/Loader.js index d2d59e4..15d29ef 100644 --- a/packages/loaders/src/Loader.js +++ b/packages/loaders/src/Loader.js @@ -4,7 +4,6 @@ import TextureLoader from './TextureLoader'; /** - * * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader * * ```js diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 9fd334b..5f4cd3a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -2,12 +2,14 @@ import { PI_2 } from './const'; /** - * The PixiJS Matrix class as an object, which makes it a lot faster, - * here is a representation of it : + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js * | a | c | tx| * | b | d | ty| * | 0 | 0 | 1 | - * + * ``` * @class * @memberof PIXI */ diff --git a/packages/math/src/ObservablePoint.js b/packages/math/src/ObservablePoint.js index 677fa2c..57d9d4a 100644 --- a/packages/math/src/ObservablePoint.js +++ b/packages/math/src/ObservablePoint.js @@ -1,7 +1,8 @@ /** * The Point object represents a location in a two-dimensional coordinate system, where x represents * the horizontal axis and y represents the vertical axis. - * An observable point is a point that triggers a callback when the point's position is changed. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. * * @class * @memberof PIXI diff --git a/packages/math/src/Transform.js b/packages/math/src/Transform.js index 2125ee7..7cb6a9a 100644 --- a/packages/math/src/Transform.js +++ b/packages/math/src/Transform.js @@ -9,9 +9,6 @@ */ export default class Transform { - /** - * - */ constructor() { /** diff --git a/packages/math/src/shapes/Circle.js b/packages/math/src/shapes/Circle.js index f99bf55..3d39c6f 100644 --- a/packages/math/src/shapes/Circle.js +++ b/packages/math/src/shapes/Circle.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Circle object can be used to specify a hit area for displayObjects + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Ellipse.js b/packages/math/src/shapes/Ellipse.js index ef03fe8..c992d72 100644 --- a/packages/math/src/shapes/Ellipse.js +++ b/packages/math/src/shapes/Ellipse.js @@ -2,7 +2,7 @@ import { SHAPES } from '../const'; /** - * The Ellipse object can be used to specify a hit area for displayObjects + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. * * @class * @memberof PIXI diff --git a/packages/math/src/shapes/Polygon.js b/packages/math/src/shapes/Polygon.js index 037a949..ee38a3f 100644 --- a/packages/math/src/shapes/Polygon.js +++ b/packages/math/src/shapes/Polygon.js @@ -2,6 +2,8 @@ import { SHAPES } from '../const'; /** + * A class to define a shape via user defined co-orinates. + * * @class * @memberof PIXI */ diff --git a/packages/mesh-extras/src/SimpleMesh.js b/packages/mesh-extras/src/SimpleMesh.js index 1c78a39..3991616 100644 --- a/packages/mesh-extras/src/SimpleMesh.js +++ b/packages/mesh-extras/src/SimpleMesh.js @@ -2,9 +2,9 @@ import { Texture } from '@pixi/core'; /** - * Simple Mesh class mimics mesh in PixiJS v4, provides - * easy-to-use constructor arguments. For more robust - * customization, use {@link PIXI.Mesh}. + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * * @class * @extends PIXI.Mesh * @memberof PIXI diff --git a/packages/mesh-extras/src/SimplePlane.js b/packages/mesh-extras/src/SimplePlane.js index 1e2eab8..5771e5a 100644 --- a/packages/mesh-extras/src/SimplePlane.js +++ b/packages/mesh-extras/src/SimplePlane.js @@ -3,7 +3,7 @@ import PlaneGeometry from './geometry/PlaneGeometry'; /** - * The Plane allows you to draw a texture across several points and them manipulate these points + * The Plane allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh-extras/src/SimpleRope.js b/packages/mesh-extras/src/SimpleRope.js index 4050c5b..c3eb25e 100644 --- a/packages/mesh-extras/src/SimpleRope.js +++ b/packages/mesh-extras/src/SimpleRope.js @@ -2,7 +2,7 @@ import RopeGeometry from './geometry/RopeGeometry'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { @@ -31,6 +31,7 @@ /** * re-calculate vertices by rope points each frame + * * @member {boolean} */ this.autoUpdate = true; diff --git a/packages/mesh-extras/src/geometry/PlaneGeometry.js b/packages/mesh-extras/src/geometry/PlaneGeometry.js index 81690e0..8049e71 100644 --- a/packages/mesh-extras/src/geometry/PlaneGeometry.js +++ b/packages/mesh-extras/src/geometry/PlaneGeometry.js @@ -12,7 +12,6 @@ this.width = width; this.height = height; - // console.log('>>>>>', segWidth, segHeight); this.build(); } diff --git a/packages/mesh-extras/src/geometry/RopeGeometry.js b/packages/mesh-extras/src/geometry/RopeGeometry.js index 2eb570a..a07a1fa 100644 --- a/packages/mesh-extras/src/geometry/RopeGeometry.js +++ b/packages/mesh-extras/src/geometry/RopeGeometry.js @@ -1,6 +1,6 @@ import { MeshGeometry } from '@pixi/mesh'; /** - * The rope allows you to draw a texture across several points and them manipulate these points + * The rope allows you to draw a texture across several points and then manipulate these points * *```js * for (let i = 0; i < 20; i++) { diff --git a/packages/mesh/src/Mesh.js b/packages/mesh/src/Mesh.js index 80a8dd6..f88f0fc 100644 --- a/packages/mesh/src/Mesh.js +++ b/packages/mesh/src/Mesh.js @@ -9,14 +9,17 @@ const tempPolygon = new Polygon(); /** - * Base mesh class - * The reason for this class is to empower you to have maximum flexibility to render any kind of webGL you can think of. - * This class assumes a certain level of webGL knowledge. + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. * If you know a bit this should abstract enough away to make you life easier! + * * Pretty much ALL WebGL can be broken down into the following: - * Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * Shader - This is the shader that pixi will render the geometry with. (attributes in the shader must match the geometry!) - * State - This is the state of WebGL required to render the mesh. + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * * Through a combination of the above elements you can render anything you want, 2D or 3D! * * @class @@ -28,7 +31,7 @@ /** * @param {PIXI.Geometry} geometry the geometry the mesh will use * @param {PIXI.Shader|PIXI.MeshMaterial} shader the shader the mesh will use - * @param {PIXI.State} [state] the state that the webGL context is required to be in to render the mesh + * @param {PIXI.State} [state] the state that the WebGL context is required to be in to render the mesh * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] the drawMode, can be any of the PIXI.DRAW_MODES consts */ @@ -52,7 +55,7 @@ this.shader = shader; /** - * Represents the webGL state the Mesh required to render, excludes shader and geometry. E.g., + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. * @member {PIXI.State} */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index c102fd8..4d03d37 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -19,9 +19,6 @@ */ class CacheData { - /** - * - */ constructor() { this.textureCacheId = null; @@ -185,7 +182,7 @@ bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the webGL renderer is currently using. + // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. const cachedRenderTarget = renderer._activeRenderTarget; // We also store the filter stack - I will definitely look to change how this works a little later down the line. @@ -279,7 +276,7 @@ this._cacheData.sprite._renderCanvas(renderer); }; -// TODO this can be the same as the webGL version.. will need to do a little tweaking first though.. +// TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite * diff --git a/packages/particles/src/ParticleContainer.js b/packages/particles/src/ParticleContainer.js index 2c9e62a..5e37746 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -4,13 +4,15 @@ /** * The ParticleContainer class is a really fast version of the Container built solely for speed, - * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that most advanced - * functionality will not work. ParticleContainer implements the basic object transform (position, scale, rotation) + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) * and some advanced functionality like tint (as of v4.5.6). + * * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. * - * It's extremely easy to use : - * + * It's extremely easy to use: * ```js * let container = new ParticleContainer(); * @@ -193,7 +195,7 @@ /** * The tint applied to the container. This is a hex value. * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. * @member {number} * @default 0xFFFFFF */ diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 43722ce..253b0ed 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -19,6 +19,7 @@ */ /** + * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI @@ -281,6 +282,7 @@ } /** + * Uploads the position. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -312,6 +314,7 @@ } /** + * Uploads the rotiation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -336,6 +339,7 @@ } /** + * Uploads the Uvs * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -387,6 +391,7 @@ } /** + * Uploads the tint. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -417,7 +422,6 @@ /** * Destroys the ParticleRenderer. - * */ destroy() { diff --git a/packages/prepare/src/Prepare.js b/packages/prepare/src/Prepare.js index 39bbe0f..3d8ada4 100644 --- a/packages/prepare/src/Prepare.js +++ b/packages/prepare/src/Prepare.js @@ -5,7 +5,7 @@ /** * The prepare manager provides functionality to upload content to the GPU. * - * An instance of this class is automatically created by default, and can be found at renderer.plugins.prepare + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare` * * @class * @extends PIXI.prepare.BasePrepare diff --git a/packages/sprite/src/Sprite.js b/packages/sprite/src/Sprite.js index 981683e..683fe10 100644 --- a/packages/sprite/src/Sprite.js +++ b/packages/sprite/src/Sprite.js @@ -17,7 +17,8 @@ * let sprite = new PIXI.Sprite.from('assets/image.png'); * ``` * - * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}: + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. * * ```js * PIXI.loader.add("assets/spritesheet.json").load(setup); diff --git a/packages/spritesheet/src/SpritesheetLoader.js b/packages/spritesheet/src/SpritesheetLoader.js index 9c016be..2c515e1 100644 --- a/packages/spritesheet/src/SpritesheetLoader.js +++ b/packages/spritesheet/src/SpritesheetLoader.js @@ -3,10 +3,11 @@ import Spritesheet from './Spritesheet'; /** - * {@link PIXI.Loader Loader} middleware for loading - * texture atlases that have been created with TexturePacker or - * similar JSON-based spritesheet. This automatically generates - * Texture resources. + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin diff --git a/packages/text-bitmap/src/BitmapText.js b/packages/text-bitmap/src/BitmapText.js index 8a3efcf..e839df3 100644 --- a/packages/text-bitmap/src/BitmapText.js +++ b/packages/text-bitmap/src/BitmapText.js @@ -6,19 +6,28 @@ import { removeItems, getResolutionOfUrl } from '@pixi/utils'; /** - * A BitmapText object will create a line or multiple lines of text using bitmap font. To - * split a line you can use '\n', '\r' or '\r\n' in your string. You can generate the fnt files using: + * A BitmapText object will create a line or multiple lines of text using bitmap font. * - * A BitmapText can only be created when the font is loaded + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * You can generate the fnt files using + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. * * ```js * // in this case the font is in a file called 'desyrel.fnt' * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); * ``` * - * http://www.angelcode.com/products/bmfont/ for Windows or - * - * http://www.bmglyph.com/ for Mac. + * * @class * @extends PIXI.Container diff --git a/packages/text/src/Text.js b/packages/text/src/Text.js index d36d68f..965a019 100644 --- a/packages/text/src/Text.js +++ b/packages/text/src/Text.js @@ -15,8 +15,18 @@ }; /** - * A Text Object will create a line or multiple lines of text. To split a line you can use '\n' in your text string, - * or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object. + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. * * A Text can be created directly from a string and a style object, * which can be generated [here](https://pixijs.io/pixi-text-style). diff --git a/packages/text/src/TextMetrics.js b/packages/text/src/TextMetrics.js index 35f145a..7e7e715 100644 --- a/packages/text/src/TextMetrics.js +++ b/packages/text/src/TextMetrics.js @@ -637,11 +637,13 @@ /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. - * @class FontMetrics - * @memberof PIXI.TextMetrics + * + * @typedef {object} FontMetrics * @property {number} ascent - The ascent distance * @property {number} descent - The descent distance * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private */ const canvas = document.createElement('canvas'); diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 09f4d73..dc81a35 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -37,9 +37,11 @@ }; /** - * A TextStyle Object decorates a Text Object. It can be shared between - * multiple Text objects. Changing the style will update all text objects using it. - * It can be generated [here](https://pixijs.io/pixi-text-style). + * A TextStyle Object contains information to decorate a Text objects. + * + * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. + * + * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). * * @class * @memberof PIXI diff --git a/packages/ticker/src/Ticker.js b/packages/ticker/src/Ticker.js index 8f10da3..8e39e78 100644 --- a/packages/ticker/src/Ticker.js +++ b/packages/ticker/src/Ticker.js @@ -4,19 +4,15 @@ /** * A Ticker class that runs an update loop that other objects listen to. - * This class is composed around listeners - * meant for execution on the next requested animation frame. - * Animation frames are requested only when necessary, - * e.g. When the ticker is started and the emitter has listeners. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. * * @class * @memberof PIXI */ export default class Ticker { - /** - * - */ constructor() { /** diff --git a/packages/utils/src/index.js b/packages/utils/src/index.js index a46acc5..e3e08de 100644 --- a/packages/utils/src/index.js +++ b/packages/utils/src/index.js @@ -18,6 +18,8 @@ */ /** + * A simple JS library that detects mobile devices + * * @see {@link https://github.com/kaimallea/isMobile} * * @memberof PIXI.utils @@ -28,6 +30,8 @@ export { isMobile }; /** + * Remove items from a javascript array without generating garbage + * * @see {@link https://github.com/mreinstein/remove-array-items} * * @memberof PIXI.utils @@ -38,6 +42,8 @@ export { removeItems }; /** + * A high performance event emitter + * * @see {@link https://github.com/primus/eventemitter3} * * @memberof PIXI.utils @@ -54,6 +60,8 @@ export { mixins }; /** + * A polygon triangulation library + * * @see {@link https://github.com/mapbox/earcut} * * @memberof PIXI.utils diff --git a/packages/utils/src/media/CanvasRenderTarget.js b/packages/utils/src/media/CanvasRenderTarget.js index 7d202de..8fe320f 100644 --- a/packages/utils/src/media/CanvasRenderTarget.js +++ b/packages/utils/src/media/CanvasRenderTarget.js @@ -1,7 +1,7 @@ import { settings } from '@pixi/settings'; /** - * Creates a Canvas element of the given size. + * Creates a Canvas element of the given size to be used as a target for rendering to. * * @class * @memberof PIXI.utils