This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,23 @@
import type { ExtensionMetadata } from '../../../extensions/Extensions';
import type { Point } from '../../../maths/point/Point';
import type { Bounds } from '../../../scene/container/bounds/Bounds';
import type { Container } from '../../../scene/container/Container';
import type { Effect } from '../../../scene/container/Effect';
import type { PoolItem } from '../../../utils/pool/Pool';
export declare class AlphaMask implements Effect, PoolItem {
static extension: ExtensionMetadata;
priority: number;
mask: Container;
pipe: string;
renderMaskToTexture: boolean;
constructor(options?: {
mask: Container;
});
init(mask: Container): void;
reset(): void;
addBounds(bounds: Bounds, skipUpdateTransform?: boolean): void;
addLocalBounds(bounds: Bounds, localRoot: Container): void;
containsPoint(point: Point, hitTestFn: (container: Container, point: Point) => boolean): boolean;
destroy(): void;
static test(mask: any): boolean;
}

View File

@@ -0,0 +1,48 @@
'use strict';
var Extensions = require('../../../extensions/Extensions.js');
var Sprite = require('../../../scene/sprite/Sprite.js');
var addMaskBounds = require('../utils/addMaskBounds.js');
var addMaskLocalBounds = require('../utils/addMaskLocalBounds.js');
"use strict";
class AlphaMask {
constructor(options) {
this.priority = 0;
this.pipe = "alphaMask";
if (options?.mask) {
this.init(options.mask);
}
}
init(mask) {
this.mask = mask;
this.renderMaskToTexture = !(mask instanceof Sprite.Sprite);
this.mask.renderable = this.renderMaskToTexture;
this.mask.includeInBuild = !this.renderMaskToTexture;
this.mask.measurable = false;
}
reset() {
this.mask.measurable = true;
this.mask = null;
}
addBounds(bounds, skipUpdateTransform) {
addMaskBounds.addMaskBounds(this.mask, bounds, skipUpdateTransform);
}
addLocalBounds(bounds, localRoot) {
addMaskLocalBounds.addMaskLocalBounds(this.mask, bounds, localRoot);
}
containsPoint(point, hitTestFn) {
const mask = this.mask;
return hitTestFn(mask, point);
}
destroy() {
this.reset();
}
static test(mask) {
return mask instanceof Sprite.Sprite;
}
}
AlphaMask.extension = Extensions.ExtensionType.MaskEffect;
exports.AlphaMask = AlphaMask;
//# sourceMappingURL=AlphaMask.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AlphaMask.js","sources":["../../../../src/rendering/mask/alpha/AlphaMask.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { Sprite } from '../../../scene/sprite/Sprite';\nimport { addMaskBounds } from '../utils/addMaskBounds';\nimport { addMaskLocalBounds } from '../utils/addMaskLocalBounds';\n\nimport type { ExtensionMetadata } from '../../../extensions/Extensions';\nimport type { Point } from '../../../maths/point/Point';\nimport type { Bounds } from '../../../scene/container/bounds/Bounds';\nimport type { Container } from '../../../scene/container/Container';\nimport type { Effect } from '../../../scene/container/Effect';\nimport type { PoolItem } from '../../../utils/pool/Pool';\n\nexport class AlphaMask implements Effect, PoolItem\n{\n public static extension: ExtensionMetadata = ExtensionType.MaskEffect;\n\n public priority = 0;\n public mask: Container;\n public pipe = 'alphaMask';\n public renderMaskToTexture: boolean;\n\n constructor(options?: {mask: Container})\n {\n if (options?.mask)\n {\n this.init(options.mask);\n }\n }\n\n public init(mask: Container): void\n {\n this.mask = mask;\n\n // TODO - might want to change this to adjust on the fly\n // user may add children to the sprite..\n this.renderMaskToTexture = !(mask instanceof Sprite);\n\n this.mask.renderable = this.renderMaskToTexture;\n this.mask.includeInBuild = !this.renderMaskToTexture;\n\n this.mask.measurable = false;\n }\n\n public reset()\n {\n this.mask.measurable = true;\n this.mask = null;\n }\n\n public addBounds(bounds: Bounds, skipUpdateTransform?: boolean): void\n {\n addMaskBounds(this.mask, bounds, skipUpdateTransform);\n }\n\n public addLocalBounds(bounds: Bounds, localRoot: Container): void\n {\n addMaskLocalBounds(this.mask, bounds, localRoot);\n }\n\n public containsPoint(point: Point, hitTestFn: (container: Container, point: Point) => boolean): boolean\n {\n const mask = this.mask as any;\n\n // if the point is in the mask, yay!\n return hitTestFn(mask, point);\n }\n\n public destroy(): void\n {\n this.reset();\n }\n\n public static test(mask: any): boolean\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A;AAGlB,IAAO,OAAA,SAAA,CAAU,MAAM,KAAK,CAAA,CAAA;AAAA,GAChC;AAAA,EAEO,OACP,GAAA;AACI,IAAA,IAAA,CAAK,KAAM,EAAA,CAAA;AAAA,GACf;AAAA,EAEA,OAAc,KAAK,IACnB,EAAA;AACI,IAAA,OAAO,IAAgB,YAAAF,aAAA,CAAA;AAAA,GAC3B;AACJ,CAAA;AAhEa,SAAA,CAEK,YAA+BG,wBAAc,CAAA,UAAA;;;;"}

View File

@@ -0,0 +1,46 @@
import { ExtensionType } from '../../../extensions/Extensions.mjs';
import { Sprite } from '../../../scene/sprite/Sprite.mjs';
import { addMaskBounds } from '../utils/addMaskBounds.mjs';
import { addMaskLocalBounds } from '../utils/addMaskLocalBounds.mjs';
"use strict";
class AlphaMask {
constructor(options) {
this.priority = 0;
this.pipe = "alphaMask";
if (options?.mask) {
this.init(options.mask);
}
}
init(mask) {
this.mask = mask;
this.renderMaskToTexture = !(mask instanceof Sprite);
this.mask.renderable = this.renderMaskToTexture;
this.mask.includeInBuild = !this.renderMaskToTexture;
this.mask.measurable = false;
}
reset() {
this.mask.measurable = true;
this.mask = null;
}
addBounds(bounds, skipUpdateTransform) {
addMaskBounds(this.mask, bounds, skipUpdateTransform);
}
addLocalBounds(bounds, localRoot) {
addMaskLocalBounds(this.mask, bounds, localRoot);
}
containsPoint(point, hitTestFn) {
const mask = this.mask;
return hitTestFn(mask, point);
}
destroy() {
this.reset();
}
static test(mask) {
return mask instanceof Sprite;
}
}
AlphaMask.extension = ExtensionType.MaskEffect;
export { AlphaMask };
//# sourceMappingURL=AlphaMask.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AlphaMask.mjs","sources":["../../../../src/rendering/mask/alpha/AlphaMask.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { Sprite } from '../../../scene/sprite/Sprite';\nimport { addMaskBounds } from '../utils/addMaskBounds';\nimport { addMaskLocalBounds } from '../utils/addMaskLocalBounds';\n\nimport type { ExtensionMetadata } from '../../../extensions/Extensions';\nimport type { Point } from '../../../maths/point/Point';\nimport type { Bounds } from '../../../scene/container/bounds/Bounds';\nimport type { Container } from '../../../scene/container/Container';\nimport type { Effect } from '../../../scene/container/Effect';\nimport type { PoolItem } from '../../../utils/pool/Pool';\n\nexport class AlphaMask implements Effect, PoolItem\n{\n public static extension: ExtensionMetadata = ExtensionType.MaskEffect;\n\n public priority = 0;\n public mask: Container;\n public pipe = 'alphaMask';\n public renderMaskToTexture: boolean;\n\n constructor(options?: {mask: Container})\n {\n if (options?.mask)\n {\n this.init(options.mask);\n }\n }\n\n public init(mask: Container): void\n {\n this.mask = mask;\n\n // TODO - might want to change this to adjust on the fly\n // user may add children to the sprite..\n this.renderMaskToTexture = !(mask instanceof Sprite);\n\n this.mask.renderable = this.renderMaskToTexture;\n this.mask.includeInBuild = !this.renderMaskToTexture;\n\n this.mask.measurable = false;\n }\n\n public reset()\n {\n this.mask.measurable = true;\n this.mask = null;\n }\n\n public addBounds(bounds: Bounds, skipUpdateTransform?: boolean): void\n {\n addMaskBounds(this.mask, bounds, skipUpdateTransform);\n }\n\n public addLocalBounds(bounds: Bounds, localRoot: Container): void\n {\n addMaskLocalBounds(this.mask, bounds, localRoot);\n }\n\n public containsPoint(point: Point, hitTestFn: (container: Container, point: Point) => boolean): boolean\n {\n const mask = this.mask as any;\n\n // if the point is in the mask, yay!\n return hitTestFn(mask, point);\n }\n\n public destroy(): void\n {\n this.reset();\n }\n\n public static test(mask: any): boolean\n {\n return mask instanceof Sprite;\n }\n}\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,SACb,CAAA;AAAA,EAQI,YAAY,OACZ,EAAA;AANA,IAAA,IAAA,CAAO,QAAW,GAAA,CAAA,CAAA;AAElB,IAAA,IAAA,CAAO,IAAO,GAAA,WAAA,CAAA;AAKV,IAAA,IAAI,SAAS,IACb,EAAA;AACI,MAAK,IAAA,CAAA,IAAA,CAAK,QAAQ,IAAI,CAAA,CAAA;AA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ensions/Extensions';
import { FilterEffect } from '../../../filters/FilterEffect';
import { Sprite } from '../../../scene/sprite/Sprite';
import { Texture } from '../../renderers/shared/texture/Texture';
import type { Container } from '../../../scene/container/Container';
import type { Effect } from '../../../scene/container/Effect';
import type { PoolItem } from '../../../utils/pool/Pool';
import type { Instruction } from '../../renderers/shared/instructions/Instruction';
import type { InstructionSet } from '../../renderers/shared/instructions/InstructionSet';
import type { InstructionPipe } from '../../renderers/shared/instructions/RenderPipe';
import type { RenderTarget } from '../../renderers/shared/renderTarget/RenderTarget';
import type { Renderer } from '../../renderers/types';
import type { AlphaMask } from './AlphaMask';
type MaskMode = 'pushMaskBegin' | 'pushMaskEnd' | 'popMaskBegin' | 'popMaskEnd';
declare class AlphaMaskEffect extends FilterEffect implements PoolItem {
constructor();
get sprite(): Sprite;
set sprite(value: Sprite);
init: () => void;
}
export interface AlphaMaskInstruction extends Instruction {
renderPipeId: 'alphaMask';
action: MaskMode;
mask: AlphaMask;
maskedContainer: Container;
renderMask: boolean;
}
export interface AlphaMaskData {
filterEffect: AlphaMaskEffect;
maskedContainer: Container;
previousRenderTarget?: RenderTarget;
filterTexture?: Texture;
}
export declare class AlphaMaskPipe implements InstructionPipe<AlphaMaskInstruction> {
/** @ignore */
static extension: {
readonly type: readonly [ExtensionType.WebGLPipes, ExtensionType.WebGPUPipes, ExtensionType.CanvasPipes];
readonly name: "alphaMask";
};
private _renderer;
private _activeMaskStage;
constructor(renderer: Renderer);
push(mask: Effect, maskedContainer: Container, instructionSet: InstructionSet): void;
pop(mask: Effect, _maskedContainer: Container, instructionSet: InstructionSet): void;
execute(instruction: AlphaMaskInstruction): void;
destroy(): void;
}
export {};

View File

@@ -0,0 +1,156 @@
'use strict';
var Extensions = require('../../../extensions/Extensions.js');
var FilterEffect = require('../../../filters/FilterEffect.js');
var MaskFilter = require('../../../filters/mask/MaskFilter.js');
var Bounds = require('../../../scene/container/bounds/Bounds.js');
var getGlobalBounds = require('../../../scene/container/bounds/getGlobalBounds.js');
var buildInstructions = require('../../../scene/container/utils/buildInstructions.js');
var Sprite = require('../../../scene/sprite/Sprite.js');
var PoolGroup = require('../../../utils/pool/PoolGroup.js');
var Texture = require('../../renderers/shared/texture/Texture.js');
var TexturePool = require('../../renderers/shared/texture/TexturePool.js');
var types = require('../../renderers/types.js');
"use strict";
const tempBounds = new Bounds.Bounds();
class AlphaMaskEffect extends FilterEffect.FilterEffect {
constructor() {
super();
this.filters = [new MaskFilter.MaskFilter({
sprite: new Sprite.Sprite(Texture.Texture.EMPTY),
resolution: "inherit",
antialias: "inherit"
})];
}
get sprite() {
return this.filters[0].sprite;
}
set sprite(value) {
this.filters[0].sprite = value;
}
}
class AlphaMaskPipe {
constructor(renderer) {
this._activeMaskStage = [];
this._renderer = renderer;
}
push(mask, maskedContainer, instructionSet) {
const renderer = this._renderer;
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "pushMaskBegin",
mask,
canBundle: false,
maskedContainer
});
if (mask.renderMaskToTexture) {
const maskContainer = mask.mask;
maskContainer.includeInBuild = true;
buildInstructions.collectAllRenderables(
maskContainer,
instructionSet,
renderer
);
maskContainer.includeInBuild = false;
}
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "pushMaskEnd",
mask,
maskedContainer,
canBundle: false
});
}
pop(mask, _maskedContainer, instructionSet) {
const renderer = this._renderer;
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "popMaskEnd",
mask,
canBundle: false
});
}
execute(instruction) {
const renderer = this._renderer;
const renderMask = instruction.mask.renderMaskToTexture;
if (instruction.action === "pushMaskBegin") {
const filterEffect = PoolGroup.BigPool.get(AlphaMaskEffect);
if (renderMask) {
instruction.mask.mask.measurable = true;
const bounds = getGlobalBounds.getGlobalBounds(instruction.mask.mask, true, tempBounds);
instruction.mask.mask.measurable = false;
bounds.ceil();
const colorTextureSource = renderer.renderTarget.renderTarget.colorTexture.source;
const filterTexture = TexturePool.TexturePool.getOptimalTexture(
bounds.width,
bounds.height,
colorTextureSource._resolution,
colorTextureSource.antialias
);
renderer.renderTarget.push(filterTexture, true);
renderer.globalUniforms.push({
offset: bounds,
worldColor: 4294967295
});
const sprite = filterEffect.sprite;
sprite.texture = filterTexture;
sprite.worldTransform.tx = bounds.minX;
sprite.worldTransform.ty = bounds.minY;
this._activeMaskStage.push({
filterEffect,
maskedContainer: instruction.maskedContainer,
filterTexture
});
} else {
filterEffect.sprite = instruction.mask.mask;
this._activeMaskStage.push({
filterEffect,
maskedContainer: instruction.maskedContainer
});
}
} else if (instruction.action === "pushMaskEnd") {
const maskData = this._activeMaskStage[this._activeMaskStage.length - 1];
if (renderMask) {
if (renderer.type === types.RendererType.WEBGL) {
renderer.renderTarget.finishRenderPass();
}
renderer.renderTarget.pop();
renderer.globalUniforms.pop();
}
renderer.filter.push({
renderPipeId: "filter",
action: "pushFilter",
container: maskData.maskedContainer,
filterEffect: maskData.filterEffect,
canBundle: false
});
} else if (instruction.action === "popMaskEnd") {
renderer.filter.pop();
const maskData = this._activeMaskStage.pop();
if (renderMask) {
TexturePool.TexturePool.returnTexture(maskData.filterTexture);
}
PoolGroup.BigPool.return(maskData.filterEffect);
}
}
destroy() {
this._renderer = null;
this._activeMaskStage = null;
}
}
/** @ignore */
AlphaMaskPipe.extension = {
type: [
Extensions.ExtensionType.WebGLPipes,
Extensions.ExtensionType.WebGPUPipes,
Extensions.ExtensionType.CanvasPipes
],
name: "alphaMask"
};
exports.AlphaMaskPipe = AlphaMaskPipe;
//# sourceMappingURL=AlphaMaskPipe.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,154 @@
import { ExtensionType } from '../../../extensions/Extensions.mjs';
import { FilterEffect } from '../../../filters/FilterEffect.mjs';
import { MaskFilter } from '../../../filters/mask/MaskFilter.mjs';
import { Bounds } from '../../../scene/container/bounds/Bounds.mjs';
import { getGlobalBounds } from '../../../scene/container/bounds/getGlobalBounds.mjs';
import { collectAllRenderables } from '../../../scene/container/utils/buildInstructions.mjs';
import { Sprite } from '../../../scene/sprite/Sprite.mjs';
import { BigPool } from '../../../utils/pool/PoolGroup.mjs';
import { Texture } from '../../renderers/shared/texture/Texture.mjs';
import { TexturePool } from '../../renderers/shared/texture/TexturePool.mjs';
import { RendererType } from '../../renderers/types.mjs';
"use strict";
const tempBounds = new Bounds();
class AlphaMaskEffect extends FilterEffect {
constructor() {
super();
this.filters = [new MaskFilter({
sprite: new Sprite(Texture.EMPTY),
resolution: "inherit",
antialias: "inherit"
})];
}
get sprite() {
return this.filters[0].sprite;
}
set sprite(value) {
this.filters[0].sprite = value;
}
}
class AlphaMaskPipe {
constructor(renderer) {
this._activeMaskStage = [];
this._renderer = renderer;
}
push(mask, maskedContainer, instructionSet) {
const renderer = this._renderer;
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "pushMaskBegin",
mask,
canBundle: false,
maskedContainer
});
if (mask.renderMaskToTexture) {
const maskContainer = mask.mask;
maskContainer.includeInBuild = true;
collectAllRenderables(
maskContainer,
instructionSet,
renderer
);
maskContainer.includeInBuild = false;
}
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "pushMaskEnd",
mask,
maskedContainer,
canBundle: false
});
}
pop(mask, _maskedContainer, instructionSet) {
const renderer = this._renderer;
renderer.renderPipes.batch.break(instructionSet);
instructionSet.add({
renderPipeId: "alphaMask",
action: "popMaskEnd",
mask,
canBundle: false
});
}
execute(instruction) {
const renderer = this._renderer;
const renderMask = instruction.mask.renderMaskToTexture;
if (instruction.action === "pushMaskBegin") {
const filterEffect = BigPool.get(AlphaMaskEffect);
if (renderMask) {
instruction.mask.mask.measurable = true;
const bounds = getGlobalBounds(instruction.mask.mask, true, tempBounds);
instruction.mask.mask.measurable = false;
bounds.ceil();
const colorTextureSource = renderer.renderTarget.renderTarget.colorTexture.source;
const filterTexture = TexturePool.getOptimalTexture(
bounds.width,
bounds.height,
colorTextureSource._resolution,
colorTextureSource.antialias
);
renderer.renderTarget.push(filterTexture, true);
renderer.globalUniforms.push({
offset: bounds,
worldColor: 4294967295
});
const sprite = filterEffect.sprite;
sprite.texture = filterTexture;
sprite.worldTransform.tx = bounds.minX;
sprite.worldTransform.ty = bounds.minY;
this._activeMaskStage.push({
filterEffect,
maskedContainer: instruction.maskedContainer,
filterTexture
});
} else {
filterEffect.sprite = instruction.mask.mask;
this._activeMaskStage.push({
filterEffect,
maskedContainer: instruction.maskedContainer
});
}
} else if (instruction.action === "pushMaskEnd") {
const maskData = this._activeMaskStage[this._activeMaskStage.length - 1];
if (renderMask) {
if (renderer.type === RendererType.WEBGL) {
renderer.renderTarget.finishRenderPass();
}
renderer.renderTarget.pop();
renderer.globalUniforms.pop();
}
renderer.filter.push({
renderPipeId: "filter",
action: "pushFilter",
container: maskData.maskedContainer,
filterEffect: maskData.filterEffect,
canBundle: false
});
} else if (instruction.action === "popMaskEnd") {
renderer.filter.pop();
const maskData = this._activeMaskStage.pop();
if (renderMask) {
TexturePool.returnTexture(maskData.filterTexture);
}
BigPool.return(maskData.filterEffect);
}
}
destroy() {
this._renderer = null;
this._activeMaskStage = null;
}
}
/** @ignore */
AlphaMaskPipe.extension = {
type: [
ExtensionType.WebGLPipes,
ExtensionType.WebGPUPipes,
ExtensionType.CanvasPipes
],
name: "alphaMask"
};
export { AlphaMaskPipe };
//# sourceMappingURL=AlphaMaskPipe.mjs.map

File diff suppressed because one or more lines are too long