sdfsdfs
This commit is contained in:
7
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.d.ts
generated
vendored
Normal file
7
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix';
|
||||
import { Shader } from '../../../rendering/renderers/shared/shader/Shader';
|
||||
import { Texture } from '../../../rendering/renderers/shared/texture/Texture';
|
||||
export declare class TilingSpriteShader extends Shader {
|
||||
constructor();
|
||||
updateUniforms(width: number, height: number, matrix: Matrix, anchorX: number, anchorY: number, texture: Texture): void;
|
||||
}
|
86
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.js
generated
vendored
Normal file
86
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'use strict';
|
||||
|
||||
var Matrix = require('../../../maths/matrix/Matrix.js');
|
||||
var compileHighShaderToProgram = require('../../../rendering/high-shader/compileHighShaderToProgram.js');
|
||||
var localUniformBit = require('../../../rendering/high-shader/shader-bits/localUniformBit.js');
|
||||
var roundPixelsBit = require('../../../rendering/high-shader/shader-bits/roundPixelsBit.js');
|
||||
var Shader = require('../../../rendering/renderers/shared/shader/Shader.js');
|
||||
var UniformGroup = require('../../../rendering/renderers/shared/shader/UniformGroup.js');
|
||||
var Texture = require('../../../rendering/renderers/shared/texture/Texture.js');
|
||||
var tilingBit = require('./tilingBit.js');
|
||||
|
||||
"use strict";
|
||||
let gpuProgram;
|
||||
let glProgram;
|
||||
class TilingSpriteShader extends Shader.Shader {
|
||||
constructor() {
|
||||
gpuProgram ?? (gpuProgram = compileHighShaderToProgram.compileHighShaderGpuProgram({
|
||||
name: "tiling-sprite-shader",
|
||||
bits: [
|
||||
localUniformBit.localUniformBit,
|
||||
tilingBit.tilingBit,
|
||||
roundPixelsBit.roundPixelsBit
|
||||
]
|
||||
}));
|
||||
glProgram ?? (glProgram = compileHighShaderToProgram.compileHighShaderGlProgram({
|
||||
name: "tiling-sprite-shader",
|
||||
bits: [
|
||||
localUniformBit.localUniformBitGl,
|
||||
tilingBit.tilingBitGl,
|
||||
roundPixelsBit.roundPixelsBitGl
|
||||
]
|
||||
}));
|
||||
const tilingUniforms = new UniformGroup.UniformGroup({
|
||||
uMapCoord: { value: new Matrix.Matrix(), type: "mat3x3<f32>" },
|
||||
uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: "vec4<f32>" },
|
||||
uClampOffset: { value: new Float32Array([0, 0]), type: "vec2<f32>" },
|
||||
uTextureTransform: { value: new Matrix.Matrix(), type: "mat3x3<f32>" },
|
||||
uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: "vec4<f32>" }
|
||||
});
|
||||
super({
|
||||
glProgram,
|
||||
gpuProgram,
|
||||
resources: {
|
||||
localUniforms: new UniformGroup.UniformGroup({
|
||||
uTransformMatrix: { value: new Matrix.Matrix(), type: "mat3x3<f32>" },
|
||||
uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
|
||||
uRound: { value: 0, type: "f32" }
|
||||
}),
|
||||
tilingUniforms,
|
||||
uTexture: Texture.Texture.EMPTY.source,
|
||||
uSampler: Texture.Texture.EMPTY.source.style
|
||||
}
|
||||
});
|
||||
}
|
||||
updateUniforms(width, height, matrix, anchorX, anchorY, texture) {
|
||||
const tilingUniforms = this.resources.tilingUniforms;
|
||||
const textureWidth = texture.width;
|
||||
const textureHeight = texture.height;
|
||||
const textureMatrix = texture.textureMatrix;
|
||||
const uTextureTransform = tilingUniforms.uniforms.uTextureTransform;
|
||||
uTextureTransform.set(
|
||||
matrix.a * textureWidth / width,
|
||||
matrix.b * textureWidth / height,
|
||||
matrix.c * textureHeight / width,
|
||||
matrix.d * textureHeight / height,
|
||||
matrix.tx / width,
|
||||
matrix.ty / height
|
||||
);
|
||||
uTextureTransform.invert();
|
||||
tilingUniforms.uniforms.uMapCoord = textureMatrix.mapCoord;
|
||||
tilingUniforms.uniforms.uClampFrame = textureMatrix.uClampFrame;
|
||||
tilingUniforms.uniforms.uClampOffset = textureMatrix.uClampOffset;
|
||||
tilingUniforms.uniforms.uTextureTransform = uTextureTransform;
|
||||
tilingUniforms.uniforms.uSizeAnchor[0] = width;
|
||||
tilingUniforms.uniforms.uSizeAnchor[1] = height;
|
||||
tilingUniforms.uniforms.uSizeAnchor[2] = anchorX;
|
||||
tilingUniforms.uniforms.uSizeAnchor[3] = anchorY;
|
||||
if (texture) {
|
||||
this.resources.uTexture = texture.source;
|
||||
this.resources.uSampler = texture.source.style;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.TilingSpriteShader = TilingSpriteShader;
|
||||
//# sourceMappingURL=TilingSpriteShader.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
84
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.mjs
generated
vendored
Normal file
84
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.mjs
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
|
||||
import { compileHighShaderGpuProgram, compileHighShaderGlProgram } from '../../../rendering/high-shader/compileHighShaderToProgram.mjs';
|
||||
import { localUniformBit, localUniformBitGl } from '../../../rendering/high-shader/shader-bits/localUniformBit.mjs';
|
||||
import { roundPixelsBit, roundPixelsBitGl } from '../../../rendering/high-shader/shader-bits/roundPixelsBit.mjs';
|
||||
import { Shader } from '../../../rendering/renderers/shared/shader/Shader.mjs';
|
||||
import { UniformGroup } from '../../../rendering/renderers/shared/shader/UniformGroup.mjs';
|
||||
import { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';
|
||||
import { tilingBit, tilingBitGl } from './tilingBit.mjs';
|
||||
|
||||
"use strict";
|
||||
let gpuProgram;
|
||||
let glProgram;
|
||||
class TilingSpriteShader extends Shader {
|
||||
constructor() {
|
||||
gpuProgram ?? (gpuProgram = compileHighShaderGpuProgram({
|
||||
name: "tiling-sprite-shader",
|
||||
bits: [
|
||||
localUniformBit,
|
||||
tilingBit,
|
||||
roundPixelsBit
|
||||
]
|
||||
}));
|
||||
glProgram ?? (glProgram = compileHighShaderGlProgram({
|
||||
name: "tiling-sprite-shader",
|
||||
bits: [
|
||||
localUniformBitGl,
|
||||
tilingBitGl,
|
||||
roundPixelsBitGl
|
||||
]
|
||||
}));
|
||||
const tilingUniforms = new UniformGroup({
|
||||
uMapCoord: { value: new Matrix(), type: "mat3x3<f32>" },
|
||||
uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: "vec4<f32>" },
|
||||
uClampOffset: { value: new Float32Array([0, 0]), type: "vec2<f32>" },
|
||||
uTextureTransform: { value: new Matrix(), type: "mat3x3<f32>" },
|
||||
uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: "vec4<f32>" }
|
||||
});
|
||||
super({
|
||||
glProgram,
|
||||
gpuProgram,
|
||||
resources: {
|
||||
localUniforms: new UniformGroup({
|
||||
uTransformMatrix: { value: new Matrix(), type: "mat3x3<f32>" },
|
||||
uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
|
||||
uRound: { value: 0, type: "f32" }
|
||||
}),
|
||||
tilingUniforms,
|
||||
uTexture: Texture.EMPTY.source,
|
||||
uSampler: Texture.EMPTY.source.style
|
||||
}
|
||||
});
|
||||
}
|
||||
updateUniforms(width, height, matrix, anchorX, anchorY, texture) {
|
||||
const tilingUniforms = this.resources.tilingUniforms;
|
||||
const textureWidth = texture.width;
|
||||
const textureHeight = texture.height;
|
||||
const textureMatrix = texture.textureMatrix;
|
||||
const uTextureTransform = tilingUniforms.uniforms.uTextureTransform;
|
||||
uTextureTransform.set(
|
||||
matrix.a * textureWidth / width,
|
||||
matrix.b * textureWidth / height,
|
||||
matrix.c * textureHeight / width,
|
||||
matrix.d * textureHeight / height,
|
||||
matrix.tx / width,
|
||||
matrix.ty / height
|
||||
);
|
||||
uTextureTransform.invert();
|
||||
tilingUniforms.uniforms.uMapCoord = textureMatrix.mapCoord;
|
||||
tilingUniforms.uniforms.uClampFrame = textureMatrix.uClampFrame;
|
||||
tilingUniforms.uniforms.uClampOffset = textureMatrix.uClampOffset;
|
||||
tilingUniforms.uniforms.uTextureTransform = uTextureTransform;
|
||||
tilingUniforms.uniforms.uSizeAnchor[0] = width;
|
||||
tilingUniforms.uniforms.uSizeAnchor[1] = height;
|
||||
tilingUniforms.uniforms.uSizeAnchor[2] = anchorX;
|
||||
tilingUniforms.uniforms.uSizeAnchor[3] = anchorY;
|
||||
if (texture) {
|
||||
this.resources.uTexture = texture.source;
|
||||
this.resources.uSampler = texture.source.style;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { TilingSpriteShader };
|
||||
//# sourceMappingURL=TilingSpriteShader.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/TilingSpriteShader.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.d.ts
generated
vendored
Normal file
22
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export declare const tilingBit: {
|
||||
name: string;
|
||||
vertex: {
|
||||
header: string;
|
||||
main: string;
|
||||
};
|
||||
fragment: {
|
||||
header: string;
|
||||
main: string;
|
||||
};
|
||||
};
|
||||
export declare const tilingBitGl: {
|
||||
name: string;
|
||||
vertex: {
|
||||
header: string;
|
||||
main: string;
|
||||
};
|
||||
fragment: {
|
||||
header: string;
|
||||
main: string;
|
||||
};
|
||||
};
|
118
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.js
generated
vendored
Normal file
118
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const tilingBit = {
|
||||
name: "tiling-bit",
|
||||
vertex: {
|
||||
header: (
|
||||
/* wgsl */
|
||||
`
|
||||
struct TilingUniforms {
|
||||
uMapCoord:mat3x3<f32>,
|
||||
uClampFrame:vec4<f32>,
|
||||
uClampOffset:vec2<f32>,
|
||||
uTextureTransform:mat3x3<f32>,
|
||||
uSizeAnchor:vec4<f32>
|
||||
};
|
||||
|
||||
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
||||
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
||||
@group(2) @binding(2) var uSampler: sampler;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* wgsl */
|
||||
`
|
||||
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
||||
|
||||
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
||||
`
|
||||
)
|
||||
},
|
||||
fragment: {
|
||||
header: (
|
||||
/* wgsl */
|
||||
`
|
||||
struct TilingUniforms {
|
||||
uMapCoord:mat3x3<f32>,
|
||||
uClampFrame:vec4<f32>,
|
||||
uClampOffset:vec2<f32>,
|
||||
uTextureTransform:mat3x3<f32>,
|
||||
uSizeAnchor:vec4<f32>
|
||||
};
|
||||
|
||||
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
||||
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
||||
@group(2) @binding(2) var uSampler: sampler;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* wgsl */
|
||||
`
|
||||
|
||||
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
||||
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
||||
var unclamped = coord;
|
||||
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
||||
|
||||
var bias = 0.;
|
||||
|
||||
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
||||
{
|
||||
bias = -32.;
|
||||
}
|
||||
|
||||
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
||||
`
|
||||
)
|
||||
}
|
||||
};
|
||||
const tilingBitGl = {
|
||||
name: "tiling-bit",
|
||||
vertex: {
|
||||
header: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform mat3 uTextureTransform;
|
||||
uniform vec4 uSizeAnchor;
|
||||
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* glsl */
|
||||
`
|
||||
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
||||
|
||||
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
||||
`
|
||||
)
|
||||
},
|
||||
fragment: {
|
||||
header: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform sampler2D uTexture;
|
||||
uniform mat3 uMapCoord;
|
||||
uniform vec4 uClampFrame;
|
||||
uniform vec2 uClampOffset;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* glsl */
|
||||
`
|
||||
|
||||
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
||||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||||
vec2 unclamped = coord;
|
||||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||||
|
||||
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
||||
|
||||
`
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
exports.tilingBit = tilingBit;
|
||||
exports.tilingBitGl = tilingBitGl;
|
||||
//# sourceMappingURL=tilingBit.js.map
|
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tilingBit.js","sources":["../../../../src/scene/sprite-tiling/shader/tilingBit.ts"],"sourcesContent":["export const tilingBit = {\n name: 'tiling-bit',\n vertex: {\n header: /* wgsl */`\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n `,\n main: /* wgsl */`\n uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;\n\n position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;\n `\n\n },\n fragment: {\n header: /* wgsl */`\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n `,\n main: /* wgsl */`\n\n var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);\n coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;\n var unclamped = coord;\n coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);\n\n var bias = 0.;\n\n if(unclamped.x == coord.x && unclamped.y == coord.y)\n {\n bias = -32.;\n } \n\n outColor = textureSampleBias(uTexture, uSampler, coord, bias);\n `\n }\n\n};\n\nexport const tilingBitGl = {\n name: 'tiling-bit',\n vertex: {\n header: /* glsl */`\n uniform mat3 uTextureTransform;\n uniform vec4 uSizeAnchor;\n \n `,\n main: /* glsl */`\n uv = (uTextureTransform * vec3(aUV, 1.0)).xy;\n\n position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;\n `\n\n },\n fragment: {\n header: /* glsl */`\n uniform sampler2D uTexture;\n uniform mat3 uMapCoord;\n uniform vec4 uClampFrame;\n uniform vec2 uClampOffset;\n `,\n main: /* glsl */`\n\n vec2 coord = vUV + ceil(uClampOffset - vUV);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n \n outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0\n \n `\n }\n\n};\n"],"names":[],"mappings":";;;AAAO,MAAM,SAAY,GAAA;AAAA,EACrB,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACJ,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAalB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAMpB;AAAA,EACA,QAAU,EAAA;AAAA,IACN,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAalB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAgBpB;AAEJ,EAAA;AAEO,MAAM,WAAc,GAAA;AAAA,EACvB,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACJ,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAKlB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAMpB;AAAA,EACA,QAAU,EAAA;AAAA,IACN,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAMlB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAUpB;AAEJ;;;;;"}
|
115
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.mjs
generated
vendored
Normal file
115
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.mjs
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
const tilingBit = {
|
||||
name: "tiling-bit",
|
||||
vertex: {
|
||||
header: (
|
||||
/* wgsl */
|
||||
`
|
||||
struct TilingUniforms {
|
||||
uMapCoord:mat3x3<f32>,
|
||||
uClampFrame:vec4<f32>,
|
||||
uClampOffset:vec2<f32>,
|
||||
uTextureTransform:mat3x3<f32>,
|
||||
uSizeAnchor:vec4<f32>
|
||||
};
|
||||
|
||||
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
||||
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
||||
@group(2) @binding(2) var uSampler: sampler;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* wgsl */
|
||||
`
|
||||
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
||||
|
||||
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
||||
`
|
||||
)
|
||||
},
|
||||
fragment: {
|
||||
header: (
|
||||
/* wgsl */
|
||||
`
|
||||
struct TilingUniforms {
|
||||
uMapCoord:mat3x3<f32>,
|
||||
uClampFrame:vec4<f32>,
|
||||
uClampOffset:vec2<f32>,
|
||||
uTextureTransform:mat3x3<f32>,
|
||||
uSizeAnchor:vec4<f32>
|
||||
};
|
||||
|
||||
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
||||
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
||||
@group(2) @binding(2) var uSampler: sampler;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* wgsl */
|
||||
`
|
||||
|
||||
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
||||
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
||||
var unclamped = coord;
|
||||
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
||||
|
||||
var bias = 0.;
|
||||
|
||||
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
||||
{
|
||||
bias = -32.;
|
||||
}
|
||||
|
||||
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
||||
`
|
||||
)
|
||||
}
|
||||
};
|
||||
const tilingBitGl = {
|
||||
name: "tiling-bit",
|
||||
vertex: {
|
||||
header: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform mat3 uTextureTransform;
|
||||
uniform vec4 uSizeAnchor;
|
||||
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* glsl */
|
||||
`
|
||||
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
||||
|
||||
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
||||
`
|
||||
)
|
||||
},
|
||||
fragment: {
|
||||
header: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform sampler2D uTexture;
|
||||
uniform mat3 uMapCoord;
|
||||
uniform vec4 uClampFrame;
|
||||
uniform vec2 uClampOffset;
|
||||
`
|
||||
),
|
||||
main: (
|
||||
/* glsl */
|
||||
`
|
||||
|
||||
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
||||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||||
vec2 unclamped = coord;
|
||||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||||
|
||||
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
||||
|
||||
`
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
export { tilingBit, tilingBitGl };
|
||||
//# sourceMappingURL=tilingBit.mjs.map
|
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/scene/sprite-tiling/shader/tilingBit.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tilingBit.mjs","sources":["../../../../src/scene/sprite-tiling/shader/tilingBit.ts"],"sourcesContent":["export const tilingBit = {\n name: 'tiling-bit',\n vertex: {\n header: /* wgsl */`\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n `,\n main: /* wgsl */`\n uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;\n\n position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;\n `\n\n },\n fragment: {\n header: /* wgsl */`\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n `,\n main: /* wgsl */`\n\n var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);\n coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;\n var unclamped = coord;\n coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);\n\n var bias = 0.;\n\n if(unclamped.x == coord.x && unclamped.y == coord.y)\n {\n bias = -32.;\n } \n\n outColor = textureSampleBias(uTexture, uSampler, coord, bias);\n `\n }\n\n};\n\nexport const tilingBitGl = {\n name: 'tiling-bit',\n vertex: {\n header: /* glsl */`\n uniform mat3 uTextureTransform;\n uniform vec4 uSizeAnchor;\n \n `,\n main: /* glsl */`\n uv = (uTextureTransform * vec3(aUV, 1.0)).xy;\n\n position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;\n `\n\n },\n fragment: {\n header: /* glsl */`\n uniform sampler2D uTexture;\n uniform mat3 uMapCoord;\n uniform vec4 uClampFrame;\n uniform vec2 uClampOffset;\n `,\n main: /* glsl */`\n\n vec2 coord = vUV + ceil(uClampOffset - vUV);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n \n outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0\n \n `\n }\n\n};\n"],"names":[],"mappings":";AAAO,MAAM,SAAY,GAAA;AAAA,EACrB,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACJ,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAalB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAMpB;AAAA,EACA,QAAU,EAAA;AAAA,IACN,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAalB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAgBpB;AAEJ,EAAA;AAEO,MAAM,WAAc,GAAA;AAAA,EACvB,IAAM,EAAA,YAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACJ,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAKlB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAMpB;AAAA,EACA,QAAU,EAAA;AAAA,IACN,MAAA;AAAA;AAAA,MAAkB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,IAMlB,IAAA;AAAA;AAAA,MAAgB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAA,CAAA;AAAA,KAAA;AAAA,GAUpB;AAEJ;;;;"}
|
Reference in New Issue
Block a user