diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc, uniforms) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/packages/sprite/src/SpriteRenderer.js b/packages/sprite/src/SpriteRenderer.js index 1fdc253..136cdcc 100644 --- a/packages/sprite/src/SpriteRenderer.js +++ b/packages/sprite/src/SpriteRenderer.js @@ -1,7 +1,7 @@ import { Geometry, Buffer, ObjectRenderer, - checkMaxIfStatmentsInShader } from '@pixi/core'; + checkMaxIfStatementsInShader } from '@pixi/core'; import { settings } from '@pixi/settings'; import { createIndicesForQuads, premultiplyBlendMode, premultiplyTint } from '@pixi/utils'; import bitTwiddle from 'bit-twiddle'; @@ -70,7 +70,7 @@ /** * The default shaders that is used if a sprite doesn't have a more specific one. - * there is a shader for each number of textures that can be rendererd. + * there is a shader for each number of textures that can be rendered. * These shaders will also be generated on the fly as required. * @member {PIXI.Shader[]} */ @@ -114,7 +114,7 @@ this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } // generate generateMultiTextureProgram, may be a better move? @@ -223,7 +223,7 @@ for (i = 0; i < this.currentIndex; ++i) { - // upload the sprite elemetns... + // upload the sprite elements... // they have all ready been calculated so we just need to push them into the buffer. const sprite = sprites[i]; diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/packages/sprite/src/SpriteRenderer.js b/packages/sprite/src/SpriteRenderer.js index 1fdc253..136cdcc 100644 --- a/packages/sprite/src/SpriteRenderer.js +++ b/packages/sprite/src/SpriteRenderer.js @@ -1,7 +1,7 @@ import { Geometry, Buffer, ObjectRenderer, - checkMaxIfStatmentsInShader } from '@pixi/core'; + checkMaxIfStatementsInShader } from '@pixi/core'; import { settings } from '@pixi/settings'; import { createIndicesForQuads, premultiplyBlendMode, premultiplyTint } from '@pixi/utils'; import bitTwiddle from 'bit-twiddle'; @@ -70,7 +70,7 @@ /** * The default shaders that is used if a sprite doesn't have a more specific one. - * there is a shader for each number of textures that can be rendererd. + * there is a shader for each number of textures that can be rendered. * These shaders will also be generated on the fly as required. * @member {PIXI.Shader[]} */ @@ -114,7 +114,7 @@ this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } // generate generateMultiTextureProgram, may be a better move? @@ -223,7 +223,7 @@ for (i = 0; i < this.currentIndex; ++i) { - // upload the sprite elemetns... + // upload the sprite elements... // they have all ready been calculated so we just need to push them into the buffer. const sprite = sprites[i]; diff --git a/packages/text-bitmap/README.md b/packages/text-bitmap/README.md index 72fcdb3..f7e965f 100644 --- a/packages/text-bitmap/README.md +++ b/packages/text-bitmap/README.md @@ -10,6 +10,6 @@ ```js import { BitmapFontLoader } from '@pixi/text-bitmap'; -import { Loader } from '@pixi/loders'; +import { Loader } from '@pixi/loaders'; Loader.registerPlugin(BitmapFontLoader); -``` \ No newline at end of file +``` diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/packages/sprite/src/SpriteRenderer.js b/packages/sprite/src/SpriteRenderer.js index 1fdc253..136cdcc 100644 --- a/packages/sprite/src/SpriteRenderer.js +++ b/packages/sprite/src/SpriteRenderer.js @@ -1,7 +1,7 @@ import { Geometry, Buffer, ObjectRenderer, - checkMaxIfStatmentsInShader } from '@pixi/core'; + checkMaxIfStatementsInShader } from '@pixi/core'; import { settings } from '@pixi/settings'; import { createIndicesForQuads, premultiplyBlendMode, premultiplyTint } from '@pixi/utils'; import bitTwiddle from 'bit-twiddle'; @@ -70,7 +70,7 @@ /** * The default shaders that is used if a sprite doesn't have a more specific one. - * there is a shader for each number of textures that can be rendererd. + * there is a shader for each number of textures that can be rendered. * These shaders will also be generated on the fly as required. * @member {PIXI.Shader[]} */ @@ -114,7 +114,7 @@ this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } // generate generateMultiTextureProgram, may be a better move? @@ -223,7 +223,7 @@ for (i = 0; i < this.currentIndex; ++i) { - // upload the sprite elemetns... + // upload the sprite elements... // they have all ready been calculated so we just need to push them into the buffer. const sprite = sprites[i]; diff --git a/packages/text-bitmap/README.md b/packages/text-bitmap/README.md index 72fcdb3..f7e965f 100644 --- a/packages/text-bitmap/README.md +++ b/packages/text-bitmap/README.md @@ -10,6 +10,6 @@ ```js import { BitmapFontLoader } from '@pixi/text-bitmap'; -import { Loader } from '@pixi/loders'; +import { Loader } from '@pixi/loaders'; Loader.registerPlugin(BitmapFontLoader); -``` \ No newline at end of file +``` diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 56382f7..b37d69e 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -760,7 +760,7 @@ * Utility function to ensure that object properties are copied by value, and not by reference * @private * @param {Object} target Target object to copy properties into - * @param {Object} source Source object for the proporties to copy + * @param {Object} source Source object for the properties to copy * @param {string} propertyObj Object containing properties names we want to loop over */ function deepCopyProperties(target, source, propertyObj) { diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/packages/sprite/src/SpriteRenderer.js b/packages/sprite/src/SpriteRenderer.js index 1fdc253..136cdcc 100644 --- a/packages/sprite/src/SpriteRenderer.js +++ b/packages/sprite/src/SpriteRenderer.js @@ -1,7 +1,7 @@ import { Geometry, Buffer, ObjectRenderer, - checkMaxIfStatmentsInShader } from '@pixi/core'; + checkMaxIfStatementsInShader } from '@pixi/core'; import { settings } from '@pixi/settings'; import { createIndicesForQuads, premultiplyBlendMode, premultiplyTint } from '@pixi/utils'; import bitTwiddle from 'bit-twiddle'; @@ -70,7 +70,7 @@ /** * The default shaders that is used if a sprite doesn't have a more specific one. - * there is a shader for each number of textures that can be rendererd. + * there is a shader for each number of textures that can be rendered. * These shaders will also be generated on the fly as required. * @member {PIXI.Shader[]} */ @@ -114,7 +114,7 @@ this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } // generate generateMultiTextureProgram, may be a better move? @@ -223,7 +223,7 @@ for (i = 0; i < this.currentIndex; ++i) { - // upload the sprite elemetns... + // upload the sprite elements... // they have all ready been calculated so we just need to push them into the buffer. const sprite = sprites[i]; diff --git a/packages/text-bitmap/README.md b/packages/text-bitmap/README.md index 72fcdb3..f7e965f 100644 --- a/packages/text-bitmap/README.md +++ b/packages/text-bitmap/README.md @@ -10,6 +10,6 @@ ```js import { BitmapFontLoader } from '@pixi/text-bitmap'; -import { Loader } from '@pixi/loders'; +import { Loader } from '@pixi/loaders'; Loader.registerPlugin(BitmapFontLoader); -``` \ No newline at end of file +``` diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 56382f7..b37d69e 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -760,7 +760,7 @@ * Utility function to ensure that object properties are copied by value, and not by reference * @private * @param {Object} target Target object to copy properties into - * @param {Object} source Source object for the proporties to copy + * @param {Object} source Source object for the properties to copy * @param {string} propertyObj Object containing properties names we want to loop over */ function deepCopyProperties(target, source, propertyObj) { diff --git a/packages/utils/src/color/premultiply.js b/packages/utils/src/color/premultiply.js index b55ed6f..62d0760 100644 --- a/packages/utils/src/color/premultiply.js +++ b/packages/utils/src/color/premultiply.js @@ -92,7 +92,7 @@ * premultiplies tint * * @memberof PIXI.utils - * @param {number} tint integet RGB + * @param {number} tint integer RGB * @param {number} alpha floating point alpha (0.0-1.0) * @returns {number} tint multiplied by alpha */ diff --git a/.gitignore b/.gitignore index 7e96218..592e2f6 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,7 @@ dist # jetBrains IDE ignores -.idea \ No newline at end of file +.idea + +# VSCode ignores +.vscode diff --git a/bundles/pixi.js/pixi.js.d.ts b/bundles/pixi.js/pixi.js.d.ts index 9607b1a..1c5b0f4 100644 --- a/bundles/pixi.js/pixi.js.d.ts +++ b/bundles/pixi.js/pixi.js.d.ts @@ -406,7 +406,7 @@ trackedPointers(): { [key: number]: interaction.InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; // end interactive target @@ -1094,7 +1094,7 @@ antiAlias?: boolean; premultipliedAlpha: boolean; stencil: boolean; - preseveDrawingBuffer?: boolean; + preserveDrawingBuffer?: boolean; }; protected _backgroundColorRgba: number[]; @@ -1919,7 +1919,7 @@ trackedPointers(): { [key: number]: InteractionTrackingData; }; - // depricated + // deprecated defaultCursor: string; } @@ -2086,7 +2086,7 @@ destroy(): void; - // depricated + // deprecated defaultCursorStyle: string; currentCursorStyle: string; @@ -2464,7 +2464,7 @@ refresh(): void; - protected _onTexureUpdate(): void; + protected _onTextureUpdate(): void; } @@ -2701,7 +2701,7 @@ ////////////////////////////////////////////////////////////////////////////// export class Attribute { - constructor(buffer: string, size?: number, normalised?: boolean, type?: number, + constructor(buffer: string, size?: number, normalized?: boolean, type?: number, stride?: number, start?: number, instance?: number); buffer: string; @@ -2741,7 +2741,7 @@ instanceCount: number; addAttribute(id: string, buffer: Buffer | Array | ArrayBuffer | ArrayBufferView, size?: number, - normalised?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; + normalized?: boolean, type?: number, stride?: number, start?: number, instance?: boolean): void; getAttribute(id: string): Attribute; @@ -2775,7 +2775,7 @@ updateBuffers(): void; - checkCompatability(geometry: Geometry, program: Program): void; + checkCompatibility(geometry: Geometry, program: Program): void; initGeometryVao(geometry: Geometry, program: Program): any; diff --git a/packages/accessibility/src/AccessibilityManager.js b/packages/accessibility/src/AccessibilityManager.js index e2819a8..5fa7857 100644 --- a/packages/accessibility/src/AccessibilityManager.js +++ b/packages/accessibility/src/AccessibilityManager.js @@ -117,7 +117,7 @@ * @private */ this.isActive = false; - this.isMobileAccessabillity = false; + this.isMobileAccessibility = false; // let listen for tab.. once pressed we can fire up and show the accessibility layer window.addEventListener('keydown', this._onKeyDown, false); @@ -142,7 +142,7 @@ hookDiv.addEventListener('focus', () => { - this.isMobileAccessabillity = true; + this.isMobileAccessibility = true; this.activate(); document.body.removeChild(hookDiv); }); @@ -152,7 +152,7 @@ /** * Activating will cause the Accessibility layer to be shown. This is called when a user - * preses the tab key. + * presses the tab key. * * @private */ @@ -184,7 +184,7 @@ */ deactivate() { - if (!this.isActive || this.isMobileAccessabillity) + if (!this.isActive || this.isMobileAccessibility) { return; } diff --git a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js index 449060a..ce2b061 100644 --- a/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js +++ b/packages/canvas/canvas-renderer/src/utils/CanvasMaskManager.js @@ -40,7 +40,7 @@ transform.ty * resolution ); - // TODO suport sprite alpha masks?? + // TODO support sprite alpha masks?? // lots of effort required. If demand is great enough.. if (!maskData._texture) { diff --git a/packages/constants/src/index.js b/packages/constants/src/index.js index 4cc70c9..971ef53 100644 --- a/packages/constants/src/index.js +++ b/packages/constants/src/index.js @@ -7,7 +7,7 @@ * @name ENV * @type {object} * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility - * with older / less advanced devices. If you experiance unexplained flickering prefer this envionment. + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. * @property {number} WEBGL - Version 1 of WebGL * @property {number} WEBGL2 - Version 2 of WebGL */ diff --git a/packages/core/src/AbstractRenderer.js b/packages/core/src/AbstractRenderer.js index 64b2eb1..c9e6c1d 100644 --- a/packages/core/src/AbstractRenderer.js +++ b/packages/core/src/AbstractRenderer.js @@ -200,7 +200,7 @@ * Initialize the plugins. * * @protected - * @param {object} staticMap - The dictionary of staticly saved plugins. + * @param {object} staticMap - The dictionary of statically saved plugins. */ initPlugins(staticMap) { diff --git a/packages/core/src/Renderer.js b/packages/core/src/Renderer.js index a307144..ec07fe4 100644 --- a/packages/core/src/Renderer.js +++ b/packages/core/src/Renderer.js @@ -62,7 +62,7 @@ super('WebGL', options, arg2, arg3); /** - * The type of this renderer as a standardised const + * The type of this renderer as a standardized const * * @member {number} * @see PIXI.RENDERER_TYPE diff --git a/packages/core/src/context/ContextSystem.js b/packages/core/src/context/ContextSystem.js index eddc93f..a32b5cf 100644 --- a/packages/core/src/context/ContextSystem.js +++ b/packages/core/src/context/ContextSystem.js @@ -107,7 +107,7 @@ getExtensions() { - // time to set up default etensions that pixi uses.. + // time to set up default extensions that pixi uses.. const gl = this.gl; const extensions = this.extensions; diff --git a/packages/core/src/filters/FilterSystem.js b/packages/core/src/filters/FilterSystem.js index 3e37d7d..f6e7819 100644 --- a/packages/core/src/filters/FilterSystem.js +++ b/packages/core/src/filters/FilterSystem.js @@ -297,7 +297,7 @@ * Calculates the mapped matrix. * * TODO playing around here.. this is temporary - (will end up in the shader) - * this returns a matrix that will normalise map filter cords in the filter to screen space + * this returns a matrix that will normalize map filter cords in the filter to screen space * * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. @@ -353,7 +353,7 @@ /** * Gets a Power-of-Two render texture or fullScreen texture * - * TODO move to a seperate class could be on renderer? + * TODO move to a separate class could be on renderer? * * @private * @param {number} minWidth - The minimum width of the render texture in real pixels. diff --git a/packages/core/src/filters/filterTransforms.js b/packages/core/src/filters/filterTransforms.js index 87a3cd6..0be1480 100644 --- a/packages/core/src/filters/filterTransforms.js +++ b/packages/core/src/filters/filterTransforms.js @@ -7,7 +7,7 @@ * @param outputMatrix {Matrix} @alvin * @private */ -// this returns a matrix that will normalise map filter cords in the filter to screen space +// this returns a matrix that will normalize map filter cords in the filter to screen space export function calculateScreenSpaceMatrix(outputMatrix, filterArea, textureSize) { // TODO unwrap? diff --git a/packages/core/src/framebuffer/FramebufferSystem.js b/packages/core/src/framebuffer/FramebufferSystem.js index 2cc2437..d949a85 100644 --- a/packages/core/src/framebuffer/FramebufferSystem.js +++ b/packages/core/src/framebuffer/FramebufferSystem.js @@ -31,12 +31,12 @@ if (framebuffer) { - // TODO cacheing layer! + // TODO caching layer! const fbo = framebuffer.glFrameBuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); - // makesure all textures are unbound.. + // make sure all textures are unbound.. // now check for updates... if (fbo.dirtyId !== framebuffer.dirtyId) diff --git a/packages/core/src/geometry/Attribute.js b/packages/core/src/geometry/Attribute.js index 5d735a8..07f9acd 100644 --- a/packages/core/src/geometry/Attribute.js +++ b/packages/core/src/geometry/Attribute.js @@ -2,7 +2,7 @@ /** * holds the information for a single attribute structure required to render geometry. - * this does not conatina the actul data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * 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 @@ -12,17 +12,17 @@ { /** * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2. - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) */ - constructor(buffer, size, normalised = false, type = 5126, stride, start, instance) + constructor(buffer, size, normalized = false, type = 5126, stride, start, instance) { this.buffer = buffer; this.size = size; - this.normalized = normalised; + this.normalized = normalized; this.type = type; this.stride = stride; this.start = start; @@ -42,16 +42,16 @@ * * @static * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=2] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 + * @param {Number} [size=2] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Boolean} [normalised=false] should the data be normalised. + * @param {Boolean} [normalized=false] should the data be normalized. * * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided */ - static from(buffer, size, stride, start, normalised) + static from(buffer, size, stride, start, normalized) { - return new Attribute(buffer, size, stride, start, normalised); + return new Attribute(buffer, size, stride, start, normalized); } } diff --git a/packages/core/src/geometry/Geometry.js b/packages/core/src/geometry/Geometry.js index 0984c09..c6388c8 100644 --- a/packages/core/src/geometry/Geometry.js +++ b/packages/core/src/geometry/Geometry.js @@ -20,7 +20,7 @@ /** * 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 consits of buffers. + * GeometryData - the data of the model - this consists of buffers. * * This can include anything from positions, uvs, normals, colors etc.. * @@ -74,15 +74,15 @@ * * @param {String} id - the name of the attribute (matching up to a shader) * @param {PIXI.Buffer} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you hava 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalised=false] should the data be normalised. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of numbe is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) * * @return {PIXI.Geometry} returns self, useful for chaining. */ - addAttribute(id, buffer, size, normalised = false, type, stride, start, instance = false) + addAttribute(id, buffer, size, normalized = false, type, stride, start, instance = false) { if (!buffer) { @@ -107,7 +107,7 @@ { for (let i = 0; i < ids.length; i++) { - this.addAttribute(ids[i], buffer, size, normalised, type); + this.addAttribute(ids[i], buffer, size, normalized, type); } return this; @@ -121,7 +121,7 @@ bufferIndex = this.buffers.length - 1; } - this.attributes[id] = new Attribute(bufferIndex, size, normalised, type, stride, start, instance); + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); // assuming that if there is instanced data then this will be drawn with instancing! this.instanced = this.instanced || instance; @@ -311,7 +311,7 @@ * geometry attribute styles must match for this operation to work * * @param {array|PIXI.Geometry} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiney new geometry + * @returns {PIXI.Geometry} shiny new geometry! */ static merge(geometries) { diff --git a/packages/core/src/geometry/GeometrySystem.js b/packages/core/src/geometry/GeometrySystem.js index b08fc97..29b2f87 100644 --- a/packages/core/src/geometry/GeometrySystem.js +++ b/packages/core/src/geometry/GeometrySystem.js @@ -187,7 +187,7 @@ } } - checkCompatability(geometry, program) + checkCompatibility(geometry, program) { // geometry must have at least all the attributes that the shader requires. const geometryAttributes = geometry.attributes; @@ -209,7 +209,7 @@ */ initGeometryVao(geometry, program) { - this.checkCompatability(geometry, program); + this.checkCompatibility(geometry, program); const gl = this.gl; const CONTEXT_UID = this.CONTEXT_UID; diff --git a/packages/core/src/index.js b/packages/core/src/index.js index dce9df4..7c47f11 100644 --- a/packages/core/src/index.js +++ b/packages/core/src/index.js @@ -21,7 +21,7 @@ export { default as ObjectRenderer } from './batch/ObjectRenderer'; export { default as Quad } from './utils/Quad'; export { default as QuadUv } from './utils/QuadUv'; -export { default as checkMaxIfStatmentsInShader } from './shader/utils/checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './shader/utils/checkMaxIfStatementsInShader'; export { default as Shader } from './shader/Shader'; export { default as Program } from './shader/Program'; export { default as UniformGroup } from './shader/UniformGroup'; diff --git a/packages/core/src/shader/GLProgram.js b/packages/core/src/shader/GLProgram.js index 92980ca..ab4003f 100644 --- a/packages/core/src/shader/GLProgram.js +++ b/packages/core/src/shader/GLProgram.js @@ -17,7 +17,7 @@ /** * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing undeed GPU commands + * and current uniform values used for caching and preventing unneeded GPU commands * @type {Object} */ this.uniformData = uniformData; diff --git a/packages/core/src/shader/Program.js b/packages/core/src/shader/Program.js index 4b4007a..b9d55be 100644 --- a/packages/core/src/shader/Program.js +++ b/packages/core/src/shader/Program.js @@ -86,7 +86,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the attribute data for this program */ @@ -130,7 +130,7 @@ * @private * * @param {webGL-program} [program] - the webgl program - * @param {contex} [gl] - the webGL context + * @param {context} [gl] - the webGL context * * @returns {object} the uniform data for this program */ @@ -195,7 +195,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 shiney new pixi shader. + * @returns {PIXI.Shader} an shiny new pixi shader! */ static from(vertexSrc, fragmentSrc) { diff --git a/packages/core/src/shader/Shader.js b/packages/core/src/shader/Shader.js index 406cbb3..a637234 100644 --- a/packages/core/src/shader/Shader.js +++ b/packages/core/src/shader/Shader.js @@ -90,7 +90,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 shiney 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 cfcb6a2..159e30e 100644 --- a/packages/core/src/shader/ShaderSystem.js +++ b/packages/core/src/shader/ShaderSystem.js @@ -33,7 +33,7 @@ this.program = null; /** - * Cache to holds the generated functions. Stored against UniformObjects unique signiture + * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ @@ -81,7 +81,7 @@ /** * Uploads the uniforms values to the currently bound shader. * - * @param {object} uniforms - the uniforms valiues that be applied to the current shader + * @param {object} uniforms - the uniforms values that be applied to the current shader */ setUniforms(uniforms) { @@ -119,11 +119,11 @@ } /** - * Takes a uniform group and data and generates a unique signiture for them. + * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signiture of + * @param {PIXI.UniformGroup} group the uniform group to get signature of * @param {Object} uniformData uniform information generated by the shader - * @returns {String} Unique signiture of the uniform group + * @returns {String} Unique signature of the uniform group * @private */ getSignature(group, uniformData) @@ -164,11 +164,11 @@ } /** - * Generates a glProgram verion of the Shader provided. + * Generates a glProgram version of the Shader provided. * * @private * @param {PIXI.Shader} shader the shader that the glProgram will be based on. - * @return {PIXI.glCore.glProgram} A shiney new glProgram + * @return {PIXI.glCore.glProgram} A shiny new glProgram! */ generateShader(shader) { diff --git a/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js new file mode 100644 index 0000000..de926fc --- /dev/null +++ b/packages/core/src/shader/utils/checkMaxIfStatementsInShader.js @@ -0,0 +1,58 @@ +const fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}', +].join('\n'); + +export default function checkMaxIfStatementsInShader(maxIfs, gl) +{ + if (maxIfs === 0) + { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + + const shader = gl.createShader(gl.FRAGMENT_SHADER); + + while (true) // eslint-disable-line no-constant-condition + { + const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + { + maxIfs = (maxIfs / 2) | 0; + } + else + { + // valid! + break; + } + } + + return maxIfs; +} + +function generateIfTestSrc(maxIfs) +{ + let src = ''; + + for (let i = 0; i < maxIfs; ++i) + { + if (i > 0) + { + src += '\nelse '; + } + + if (i < maxIfs - 1) + { + src += `if(test == ${i}.0){}`; + } + } + + return src; +} diff --git a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js b/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js deleted file mode 100644 index 8047c96..0000000 --- a/packages/core/src/shader/utils/checkMaxIfStatmentsInShader.js +++ /dev/null @@ -1,58 +0,0 @@ -const fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}', -].join('\n'); - -export default function checkMaxIfStatmentsInShader(maxIfs, gl) -{ - if (maxIfs === 0) - { - throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); - } - - const shader = gl.createShader(gl.FRAGMENT_SHADER); - - while (true) // eslint-disable-line no-constant-condition - { - const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { - maxIfs = (maxIfs / 2) | 0; - } - else - { - // valid! - break; - } - } - - return maxIfs; -} - -function generateIfTestSrc(maxIfs) -{ - let src = ''; - - for (let i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += `if(test == ${i}.0){}`; - } - } - - return src; -} diff --git a/packages/core/src/shader/utils/extractUniformsFromSrc.js b/packages/core/src/shader/utils/extractUniformsFromSrc.js index 3d02c0a..5c39dd0 100644 --- a/packages/core/src/shader/utils/extractUniformsFromSrc.js +++ b/packages/core/src/shader/utils/extractUniformsFromSrc.js @@ -15,7 +15,7 @@ const uniforms = {}; let nameSplit; - // clean the lines a little - remove extra spaces / teabs etc + // clean the lines a little - remove extra spaces, tabs, etc. // then split along ';' const lines = string.replace(/\s+/g, ' ') .split(/\s*;\s*/); diff --git a/packages/core/src/shader/utils/generateUniformsSync.js b/packages/core/src/shader/utils/generateUniformsSync.js index 98a357f..76b6ddb 100644 --- a/packages/core/src/shader/utils/generateUniformsSync.js +++ b/packages/core/src/shader/utils/generateUniformsSync.js @@ -2,7 +2,7 @@ // v = value // ud = uniformData // uv = uniformValue -// l = loaction +// l = location const GLSL_TO_SINGLE_SETTERS_CACHED = { float: ` diff --git a/packages/core/src/shader/utils/index.js b/packages/core/src/shader/utils/index.js index 4bf8dd4..fea970a 100644 --- a/packages/core/src/shader/utils/index.js +++ b/packages/core/src/shader/utils/index.js @@ -5,4 +5,4 @@ export { default as mapType } from './mapType'; export { default as generateUniformsSync } from './generateUniformsSync'; export { default as getTestContext } from './getTestContext'; -export { default as checkMaxIfStatmentsInShader } from './checkMaxIfStatmentsInShader'; +export { default as checkMaxIfStatementsInShader } from './checkMaxIfStatementsInShader'; diff --git a/packages/core/src/state/State.js b/packages/core/src/state/State.js index fa3f221..0308a28 100644 --- a/packages/core/src/state/State.js +++ b/packages/core/src/state/State.js @@ -8,7 +8,7 @@ /** * This is a webGL state. It is passed The WebGL StateManager. - * Each mesh renderered may require webGL to be in a different state. + * 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 @@ -144,7 +144,7 @@ } /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable poygon offset fill. + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. * * @member {number} * @default 0 diff --git a/packages/core/src/state/StateSystem.js b/packages/core/src/state/StateSystem.js index 7d8e4de..df4044a 100755 --- a/packages/core/src/state/StateSystem.js +++ b/packages/core/src/state/StateSystem.js @@ -259,9 +259,9 @@ } /** - * checks to see which updates should be checked based on which settings have been activated - * for example if blend is enabled then we shold check the blend modes each time the state is changed - * or if poygon fill is activated then we need to check if the polygone offset changes. + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * * @param {Function} func the checking function to add or remove diff --git a/packages/core/src/textures/BaseTexture.js b/packages/core/src/textures/BaseTexture.js index cbdd18e..3d42cac 100644 --- a/packages/core/src/textures/BaseTexture.js +++ b/packages/core/src/textures/BaseTexture.js @@ -409,7 +409,7 @@ } /** - * Sets the resource if it wasnt set. Throws error if resource already present + * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {BaseTexture} this diff --git a/packages/core/src/textures/Texture.js b/packages/core/src/textures/Texture.js index c7c004a..cda5aa2 100644 --- a/packages/core/src/textures/Texture.js +++ b/packages/core/src/textures/Texture.js @@ -339,7 +339,7 @@ * @static * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. * @param {String} imageUrl - File name of texture, for cache and resolving resolution. - * @param {String} [name] - Human readible name for the texture cache. If no name is + * @param {String} [name] - Human readable name for the texture cache. If no name is * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ @@ -353,7 +353,7 @@ // console.log('base resource ' + resource.width); const baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, - resultion: getResolutionOfUrl(imageUrl), + resolution: getResolutionOfUrl(imageUrl), }); const texture = new Texture(baseTexture); @@ -364,7 +364,7 @@ name = imageUrl; } - // lets also add the frame to pixi's global cache for fromFrame and fromImage fucntions + // lets also add the frame to pixi's global cache for fromFrame and fromImage functions BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); diff --git a/packages/core/src/textures/TextureSystem.js b/packages/core/src/textures/TextureSystem.js index 603f192..e4fdd9c 100644 --- a/packages/core/src/textures/TextureSystem.js +++ b/packages/core/src/textures/TextureSystem.js @@ -145,7 +145,7 @@ { const glTexture = new GLTexture(this.gl.createTexture()); - // guarentee an update.. + // guarantee an update.. glTexture.dirtyId = -1; texture._glTextures[this.CONTEXT_UID] = glTexture; diff --git a/packages/core/src/textures/resources/CubeResource.js b/packages/core/src/textures/resources/CubeResource.js index 87c9319..1d49b13 100644 --- a/packages/core/src/textures/resources/CubeResource.js +++ b/packages/core/src/textures/resources/CubeResource.js @@ -7,7 +7,7 @@ * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resoures + * @param {Array} [source] Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource @@ -38,7 +38,7 @@ } /** - * Uploade the resource + * Upload the resource */ upload(renderer, baseTexture, glTexture) { diff --git a/packages/core/src/textures/resources/Resource.js b/packages/core/src/textures/resources/Resource.js index 3c239ef..ce84b39 100644 --- a/packages/core/src/textures/resources/Resource.js +++ b/packages/core/src/textures/resources/Resource.js @@ -125,7 +125,7 @@ } /** - * This can be overriden to start preloading a resource + * This can be overridden to start preloading a resource * or do any other prepare step. * @protected * @return {Promise} Handle the validate event diff --git a/packages/core/src/textures/resources/SVGResource.js b/packages/core/src/textures/resources/SVGResource.js index b6a98e9..6338d70 100644 --- a/packages/core/src/textures/resources/SVGResource.js +++ b/packages/core/src/textures/resources/SVGResource.js @@ -34,7 +34,7 @@ this.scale = options.scale || 1; /** - * Call when completedly loaded + * Call when completely loaded * @private * @member {function} */ diff --git a/packages/display/src/Container.js b/packages/display/src/Container.js index 3e00b87..08dd670 100644 --- a/packages/display/src/Container.js +++ b/packages/display/src/Container.js @@ -58,7 +58,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.addChild(arguments[i]); @@ -214,7 +214,7 @@ if (argumentsLength > 1) { // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimised by JS runtimes + // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes for (let i = 0; i < argumentsLength; i++) { this.removeChild(arguments[i]); diff --git a/packages/display/src/DisplayObject.js b/packages/display/src/DisplayObject.js index ef4f0d7..8b9b781 100644 --- a/packages/display/src/DisplayObject.js +++ b/packages/display/src/DisplayObject.js @@ -75,7 +75,7 @@ this.worldAlpha = 1; /** - * The area the filter is applied to. This is used as more of an optimisation + * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle * * Also works as an interaction mask @@ -580,7 +580,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 * PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it - * utilises shape clipping. To remove a mask, set this property to null. + * utilities shape clipping. To remove a mask, set this property to null. * * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. * diff --git a/packages/graphics/src/Graphics.js b/packages/graphics/src/Graphics.js index b9dcf3e..304593d 100644 --- a/packages/graphics/src/Graphics.js +++ b/packages/graphics/src/Graphics.js @@ -685,7 +685,7 @@ } /** - * Draw a star shape with an abitrary number of points. + * Draw a star shape with an arbitrary number of points. * * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star diff --git a/packages/graphics/src/WebGLGraphicsData.js b/packages/graphics/src/WebGLGraphicsData.js index 9131086..7361879 100644 --- a/packages/graphics/src/WebGLGraphicsData.js +++ b/packages/graphics/src/WebGLGraphicsData.js @@ -98,7 +98,7 @@ this.glIndices = new Uint16Array(this.indices); this.indexBuffer.update(this.glIndices); - // console.log("UPKOADING,.",this.glPoints,this.glIndices) + // console.log("UPLOADING,.",this.glPoints,this.glIndices) this.dirty = false; } diff --git a/packages/graphics/src/utils/buildComplexPoly.js b/packages/graphics/src/utils/buildComplexPoly.js index a3d8ca8..59aeff2 100644 --- a/packages/graphics/src/utils/buildComplexPoly.js +++ b/packages/graphics/src/utils/buildComplexPoly.js @@ -58,7 +58,7 @@ // push a quad onto the end.. - // TODO - this aint needed! + // TODO - this ain't needed! const length = points.length / 2; for (let i = 0; i < length; i++) diff --git a/packages/graphics/src/utils/buildLine.js b/packages/graphics/src/utils/buildLine.js index 9b74549..5991d4f 100644 --- a/packages/graphics/src/utils/buildLine.js +++ b/packages/graphics/src/utils/buildLine.js @@ -25,7 +25,7 @@ } /** - * Builds a line to draw using the poligon method. + * Builds a line to draw using the polygon method. * * Ignored from docs since it is not directly exposed. * diff --git a/packages/interaction/src/InteractionManager.js b/packages/interaction/src/InteractionManager.js index 14424bd..7a51168 100644 --- a/packages/interaction/src/InteractionManager.js +++ b/packages/interaction/src/InteractionManager.js @@ -68,7 +68,7 @@ this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** - * Frequency in milliseconds that the mousemove, moveover & mouseout interaction events will be checked. + * Frequency in milliseconds that the mousemove, mouseover & mouseout interaction events will be checked. * * @member {number} * @default 10 @@ -91,7 +91,7 @@ * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ this.activeInteractionData = {}; this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; @@ -100,7 +100,7 @@ * Pool of unused InteractionData * * @private - * @member {PIXI.interation.InteractionData[]} + * @member {PIXI.interaction.InteractionData[]} */ this.interactionDataPool = []; @@ -122,7 +122,7 @@ /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. - * Setting to true will make things work more in line with how the DOM verison works. + * Setting to true will make things work more in line with how the DOM version works. * Setting to false can make things easier for things like dragging * It is currently set to false as this is how PixiJS used to work. This will be set to true in * future versions of pixi. @@ -677,7 +677,7 @@ /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have - * other DOM elements on top of the renderers Canvas element. With this you'll be bale to deletegate + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate * another DOM element to receive those events. * * @param {HTMLCanvasElement} element - the DOM element which will receive mouse and touch events. @@ -719,8 +719,8 @@ } /** - * These events are added first, so that if pointer events are normalised, they are fired - * in the same order as non-normalised events. ie. pointer event 1st, mouse / touch 2nd + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ if (this.supportsPointerEvents) { @@ -999,7 +999,7 @@ const point = interactionEvent.data.global; - // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. @@ -1008,9 +1008,9 @@ // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // - // As another little optimisation once an interactive object has been hit we can carry on + // As another little optimization once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimisation is that an object is not hit test directly if a child has already been hit. + // A final optimization is that an object is not hit test directly if a child has already been hit. interactive = displayObject.interactive || interactive; diff --git a/packages/math/src/Matrix.js b/packages/math/src/Matrix.js index 5f81325..a972d4a 100644 --- a/packages/math/src/Matrix.js +++ b/packages/math/src/Matrix.js @@ -406,7 +406,7 @@ } /** - * Resets this Matix to an identity (default) matrix. + * Resets this Matrix to an identity (default) matrix. * * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ diff --git a/packages/mesh/src/RawMesh.js b/packages/mesh/src/RawMesh.js index cc2df88..63c3125 100644 --- a/packages/mesh/src/RawMesh.js +++ b/packages/mesh/src/RawMesh.js @@ -8,14 +8,14 @@ /** * Base mesh class. - * The reason for this class is to empower you to have maximum flexbilty to render any kind of webGL you can think of. + * 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. * 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!) * Uniforms - These are the values passed to the shader when the mesh is rendered. - * As a shader can be resued accross multiple objects, it made sense to allow uniforms to exist outside of the shader + * As a shader can be reused across multiple objects, it made sense to allow uniforms to exist outside of the shader * 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! * @@ -101,7 +101,7 @@ /** * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calcualted correctly. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. * * @private */ diff --git a/packages/mixin-cache-as-bitmap/src/index.js b/packages/mixin-cache-as-bitmap/src/index.js index e63286c..c3d4550 100644 --- a/packages/mixin-cache-as-bitmap/src/index.js +++ b/packages/mixin-cache-as-bitmap/src/index.js @@ -181,7 +181,7 @@ } // for now we cache the current renderTarget that the webGL renderer is currently using. - // this could be more elegent.. + // 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. // const stack = renderer.filterManager.filterStack; @@ -275,7 +275,7 @@ this._cacheData.sprite.renderCanvas(renderer); }; -// TODO this can be the same as the webGL verison.. 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 10490ad..ac5a599 100644 --- a/packages/particles/src/ParticleContainer.js +++ b/packages/particles/src/ParticleContainer.js @@ -126,7 +126,7 @@ this.autoResize = autoResize; /** - * Used for canvas renderering. If true then the elements will be positioned at the + * Used for canvas rendering. If true then the elements will be positioned at the * nearest pixel. This provides a nice speed boost. * * @member {boolean} diff --git a/packages/particles/src/ParticleRenderer.js b/packages/particles/src/ParticleRenderer.js index 062d3b5..fa4ff45 100644 --- a/packages/particles/src/ParticleRenderer.js +++ b/packages/particles/src/ParticleRenderer.js @@ -219,7 +219,7 @@ } /** - * Uploads the verticies. + * Uploads the vertices. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array diff --git a/packages/prepare/src/BasePrepare.js b/packages/prepare/src/BasePrepare.js index ecdbc85..5b0f0ec 100644 --- a/packages/prepare/src/BasePrepare.js +++ b/packages/prepare/src/BasePrepare.js @@ -288,7 +288,7 @@ } } - // Get childen recursively + // Get children recursively if (item instanceof Container) { for (let i = item.children.length - 1; i >= 0; i--) @@ -333,7 +333,7 @@ { let result = false; - // Objects with mutliple textures + // Objects with multiple textures if (item && item._textures && item._textures.length) { for (let i = 0; i < item._textures.length; i++) diff --git a/packages/settings/src/settings.js b/packages/settings/src/settings.js index e4906af..0e05c47 100644 --- a/packages/settings/src/settings.js +++ b/packages/settings/src/settings.js @@ -3,7 +3,7 @@ /** * User's customizable globals for overriding the default PIXI settings, such - * as a renderer's default resolution, framerate, float percision, etc. + * as a renderer's default resolution, framerate, float precision, etc. * @example * // Use the native window resolution as the default resolution * // will support high-density displays when rendering diff --git a/packages/sprite/src/SpriteRenderer.js b/packages/sprite/src/SpriteRenderer.js index 1fdc253..136cdcc 100644 --- a/packages/sprite/src/SpriteRenderer.js +++ b/packages/sprite/src/SpriteRenderer.js @@ -1,7 +1,7 @@ import { Geometry, Buffer, ObjectRenderer, - checkMaxIfStatmentsInShader } from '@pixi/core'; + checkMaxIfStatementsInShader } from '@pixi/core'; import { settings } from '@pixi/settings'; import { createIndicesForQuads, premultiplyBlendMode, premultiplyTint } from '@pixi/utils'; import bitTwiddle from 'bit-twiddle'; @@ -70,7 +70,7 @@ /** * The default shaders that is used if a sprite doesn't have a more specific one. - * there is a shader for each number of textures that can be rendererd. + * there is a shader for each number of textures that can be rendered. * These shaders will also be generated on the fly as required. * @member {PIXI.Shader[]} */ @@ -114,7 +114,7 @@ this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatmentsInShader(this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } // generate generateMultiTextureProgram, may be a better move? @@ -223,7 +223,7 @@ for (i = 0; i < this.currentIndex; ++i) { - // upload the sprite elemetns... + // upload the sprite elements... // they have all ready been calculated so we just need to push them into the buffer. const sprite = sprites[i]; diff --git a/packages/text-bitmap/README.md b/packages/text-bitmap/README.md index 72fcdb3..f7e965f 100644 --- a/packages/text-bitmap/README.md +++ b/packages/text-bitmap/README.md @@ -10,6 +10,6 @@ ```js import { BitmapFontLoader } from '@pixi/text-bitmap'; -import { Loader } from '@pixi/loders'; +import { Loader } from '@pixi/loaders'; Loader.registerPlugin(BitmapFontLoader); -``` \ No newline at end of file +``` diff --git a/packages/text/src/TextStyle.js b/packages/text/src/TextStyle.js index 56382f7..b37d69e 100644 --- a/packages/text/src/TextStyle.js +++ b/packages/text/src/TextStyle.js @@ -760,7 +760,7 @@ * Utility function to ensure that object properties are copied by value, and not by reference * @private * @param {Object} target Target object to copy properties into - * @param {Object} source Source object for the proporties to copy + * @param {Object} source Source object for the properties to copy * @param {string} propertyObj Object containing properties names we want to loop over */ function deepCopyProperties(target, source, propertyObj) { diff --git a/packages/utils/src/color/premultiply.js b/packages/utils/src/color/premultiply.js index b55ed6f..62d0760 100644 --- a/packages/utils/src/color/premultiply.js +++ b/packages/utils/src/color/premultiply.js @@ -92,7 +92,7 @@ * premultiplies tint * * @memberof PIXI.utils - * @param {number} tint integet RGB + * @param {number} tint integer RGB * @param {number} alpha floating point alpha (0.0-1.0) * @returns {number} tint multiplied by alpha */ diff --git a/packages/utils/src/index.js b/packages/utils/src/index.js index 02a317d..d9bce7f 100644 --- a/packages/utils/src/index.js +++ b/packages/utils/src/index.js @@ -58,9 +58,9 @@ * * @memberof PIXI.utils * @function earcut - * @param {number[]} vertices - A flat array of vertice coordinates + * @param {number[]} vertices - A flat array of vertex coordinates * @param {number[]} [holes] - An array of hole indices - * @param {number} [dimensions=2] The number of coordinates per vertice in the input array + * @param {number} [dimensions=2] The number of coordinates per vertex in the input array * @return {number[]} Triangulated polygon */ import earcut from 'earcut';