-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PIXI Web GL
- Loading branch information
Showing
38 changed files
with
3,040 additions
and
759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
src/foundry/client/pixi/webgl/extensions/batch-renderer.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export {}; | ||
|
||
declare global { | ||
/** | ||
* A batch renderer with a customizable data transfer function to packed geometries. | ||
*/ | ||
class BatchRenderer extends PIXI.BatchRenderer { | ||
/** | ||
* The PackInterleavedGeometry function provided by the sampler. | ||
*/ | ||
protected _packInterleavedGeometry: ( | ||
element: PIXI.IBatchableElement, | ||
attributeBuffer: PIXI.ViewableBuffer, | ||
indexBuffer: Uint16Array, | ||
aIndex: number, | ||
iIndex: number, | ||
) => void; | ||
|
||
/** | ||
* The preRender function provided by the sampler and that is called just before a flush. | ||
*/ | ||
protected _preRenderBatch: (...args: any[]) => void; | ||
|
||
get uniforms(): AbstractBaseShader.Uniforms; | ||
|
||
/** | ||
* The number of reserved texture units that the shader generator should not use (maximum 4). | ||
*/ | ||
protected set reservedTextureUnits(val: number); | ||
|
||
/** | ||
* Number of reserved texture units reserved by the batch shader that cannot be used by the batch renderer. | ||
*/ | ||
get reservedTextureUnits(): number; | ||
|
||
/** | ||
* This override allows to allocate a given number of texture units reserved for a custom batched shader. | ||
* These reserved texture units won't be used to batch textures for PIXI.Sprite or SpriteMesh. | ||
* @override | ||
*/ | ||
override contextChange(): void; | ||
|
||
override start(): void; | ||
|
||
override packInterleavedGeometry( | ||
element: PIXI.IBatchableElement, | ||
attributeBuffer: PIXI.ViewableBuffer, | ||
indexBuffer: Uint16Array, | ||
aIndex: number, | ||
iIndex: number, | ||
): void; | ||
|
||
/** | ||
* Verify if a PIXI plugin exists. Check by name. | ||
* @param name - The name of the pixi plugin to check. | ||
* @returns True if the plugin exists, false otherwise. | ||
*/ | ||
static hasPlugin(name: string): boolean; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export {}; | ||
|
||
declare global { | ||
/** | ||
* A batch shader generator that could handle extra uniforms during initialization. | ||
*/ | ||
class BatchShaderGenerator extends PIXI.BatchShaderGenerator { | ||
constructor( | ||
vertexSrc: string, | ||
fragTemplate: string, | ||
batchDefaultUniforms?: (maxTextures: AbstractBaseShader.UniformValue) => AbstractBaseShader.Uniforms, | ||
); | ||
|
||
/** | ||
* Extra uniforms that could be handled by a custom batch shader. | ||
*/ | ||
_batchDefaultUniforms: ((maxTextures: AbstractBaseShader.UniformValue) => AbstractBaseShader.Uniforms) | undefined; | ||
|
||
override generateShader(maxTextures: number): PIXI.Shader; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "./batch-renderer"; | ||
import "./batch-shader-generator"; | ||
import "./blend-modes"; |
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/foundry/client/pixi/webgl/helpers/framebugger-snapshot.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export {}; | ||
|
||
declare global { | ||
/** | ||
* Provide the necessary methods to get a snapshot of the framebuffer into a render texture. | ||
* Class meant to be used as a singleton. | ||
* Created with the precious advices of dev7355608. | ||
*/ | ||
class FramebufferSnapshot { | ||
/** | ||
* The RenderTexture that is the render destination for the framebuffer snapshot. | ||
*/ | ||
framebufferTexture: PIXI.RenderTexture; | ||
|
||
/** | ||
* Get the framebuffer texture snapshot. | ||
* @param renderer - The renderer for this context. | ||
* @returns The framebuffer snapshot. | ||
*/ | ||
getFramebufferTexture(renderer: PIXI.Renderer): PIXI.RenderTexture; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "./framebugger-snapshot"; | ||
import "./smooth-noise"; | ||
import "./texture-extractor"; |
Oops, something went wrong.