This commit is contained in:
2025-01-04 00:34:03 +01:00
parent 41829408dc
commit 0ca14bbc19
18111 changed files with 1871397 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
"use strict";
var core = require("@pixi/core"), sprite = require("@pixi/sprite");
const tempPoint = new core.Point();
class TilingSprite extends sprite.Sprite {
/**
* Note: The wrap mode of the texture is forced to REPEAT on render if the size of the texture
* is a power of two, the texture's wrap mode is CLAMP, and the texture hasn't been bound yet.
* @param texture - The texture of the tiling sprite.
* @param width - The width of the tiling sprite.
* @param height - The height of the tiling sprite.
*/
constructor(texture, width = 100, height = 100) {
super(texture), this.tileTransform = new core.Transform(), this._width = width, this._height = height, this.uvMatrix = this.texture.uvMatrix || new core.TextureMatrix(texture), this.pluginName = "tilingSprite", this.uvRespectAnchor = !1;
}
/**
* Changes frame clamping in corresponding textureTransform, shortcut
* Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
* @default 0.5
* @member {number}
*/
get clampMargin() {
return this.uvMatrix.clampMargin;
}
set clampMargin(value) {
this.uvMatrix.clampMargin = value, this.uvMatrix.update(!0);
}
/** The scaling of the image that is being tiled. */
get tileScale() {
return this.tileTransform.scale;
}
set tileScale(value) {
this.tileTransform.scale.copyFrom(value);
}
/** The offset of the image that is being tiled. */
get tilePosition() {
return this.tileTransform.position;
}
set tilePosition(value) {
this.tileTransform.position.copyFrom(value);
}
/**
* @protected
*/
_onTextureUpdate() {
this.uvMatrix && (this.uvMatrix.texture = this._texture), this._cachedTint = 16777215;
}
/**
* Renders the object using the WebGL renderer
* @param renderer - The renderer
*/
_render(renderer) {
const texture = this._texture;
!texture || !texture.valid || (this.tileTransform.updateLocalTransform(), this.uvMatrix.update(), renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]), renderer.plugins[this.pluginName].render(this));
}
/** Updates the bounds of the tiling sprite. */
_calculateBounds() {
const minX = this._width * -this._anchor._x, minY = this._height * -this._anchor._y, maxX = this._width * (1 - this._anchor._x), maxY = this._height * (1 - this._anchor._y);
this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
}
/**
* Gets the local bounds of the sprite object.
* @param rect - Optional output rectangle.
* @returns The bounds.
*/
getLocalBounds(rect) {
return this.children.length === 0 ? (this._bounds.minX = this._width * -this._anchor._x, this._bounds.minY = this._height * -this._anchor._y, this._bounds.maxX = this._width * (1 - this._anchor._x), this._bounds.maxY = this._height * (1 - this._anchor._y), rect || (this._localBoundsRect || (this._localBoundsRect = new core.Rectangle()), rect = this._localBoundsRect), this._bounds.getRectangle(rect)) : super.getLocalBounds.call(this, rect);
}
/**
* Checks if a point is inside this tiling sprite.
* @param point - The point to check.
* @returns Whether or not the sprite contains the point.
*/
containsPoint(point) {
this.worldTransform.applyInverse(point, tempPoint);
const width = this._width, height = this._height, x1 = -width * this.anchor._x;
if (tempPoint.x >= x1 && tempPoint.x < x1 + width) {
const y1 = -height * this.anchor._y;
if (tempPoint.y >= y1 && tempPoint.y < y1 + height)
return !0;
}
return !1;
}
/**
* Destroys this sprite and optionally its texture and children
* @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
* have been set to that value
* @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
* method called as well. 'options' will be passed on to those calls.
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well
* @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well
*/
destroy(options) {
super.destroy(options), this.tileTransform = null, this.uvMatrix = null;
}
/**
* Helper function that creates a new tiling sprite based on the source you provide.
* The source can be - frame id, image url, video url, canvas element, video element, base texture
* @static
* @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from
* @param {object} options - See {@link PIXI.BaseTexture}'s constructor for options.
* @param {number} options.width - required width of the tiling sprite
* @param {number} options.height - required height of the tiling sprite
* @returns {PIXI.TilingSprite} The newly created texture
*/
static from(source, options) {
const texture = source instanceof core.Texture ? source : core.Texture.from(source, options);
return new TilingSprite(
texture,
options.width,
options.height
);
}
/** The width of the sprite, setting this will actually modify the scale to achieve the value set. */
get width() {
return this._width;
}
set width(value) {
this._width = value;
}
/** The height of the TilingSprite, setting this will actually modify the scale to achieve the value set. */
get height() {
return this._height;
}
set height(value) {
this._height = value;
}
}
exports.TilingSprite = TilingSprite;
//# sourceMappingURL=TilingSprite.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,131 @@
import { Point, Transform, TextureMatrix, Rectangle, Texture } from "@pixi/core";
import { Sprite } from "@pixi/sprite";
const tempPoint = new Point();
class TilingSprite extends Sprite {
/**
* Note: The wrap mode of the texture is forced to REPEAT on render if the size of the texture
* is a power of two, the texture's wrap mode is CLAMP, and the texture hasn't been bound yet.
* @param texture - The texture of the tiling sprite.
* @param width - The width of the tiling sprite.
* @param height - The height of the tiling sprite.
*/
constructor(texture, width = 100, height = 100) {
super(texture), this.tileTransform = new Transform(), this._width = width, this._height = height, this.uvMatrix = this.texture.uvMatrix || new TextureMatrix(texture), this.pluginName = "tilingSprite", this.uvRespectAnchor = !1;
}
/**
* Changes frame clamping in corresponding textureTransform, shortcut
* Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
* @default 0.5
* @member {number}
*/
get clampMargin() {
return this.uvMatrix.clampMargin;
}
set clampMargin(value) {
this.uvMatrix.clampMargin = value, this.uvMatrix.update(!0);
}
/** The scaling of the image that is being tiled. */
get tileScale() {
return this.tileTransform.scale;
}
set tileScale(value) {
this.tileTransform.scale.copyFrom(value);
}
/** The offset of the image that is being tiled. */
get tilePosition() {
return this.tileTransform.position;
}
set tilePosition(value) {
this.tileTransform.position.copyFrom(value);
}
/**
* @protected
*/
_onTextureUpdate() {
this.uvMatrix && (this.uvMatrix.texture = this._texture), this._cachedTint = 16777215;
}
/**
* Renders the object using the WebGL renderer
* @param renderer - The renderer
*/
_render(renderer) {
const texture = this._texture;
!texture || !texture.valid || (this.tileTransform.updateLocalTransform(), this.uvMatrix.update(), renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]), renderer.plugins[this.pluginName].render(this));
}
/** Updates the bounds of the tiling sprite. */
_calculateBounds() {
const minX = this._width * -this._anchor._x, minY = this._height * -this._anchor._y, maxX = this._width * (1 - this._anchor._x), maxY = this._height * (1 - this._anchor._y);
this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);
}
/**
* Gets the local bounds of the sprite object.
* @param rect - Optional output rectangle.
* @returns The bounds.
*/
getLocalBounds(rect) {
return this.children.length === 0 ? (this._bounds.minX = this._width * -this._anchor._x, this._bounds.minY = this._height * -this._anchor._y, this._bounds.maxX = this._width * (1 - this._anchor._x), this._bounds.maxY = this._height * (1 - this._anchor._y), rect || (this._localBoundsRect || (this._localBoundsRect = new Rectangle()), rect = this._localBoundsRect), this._bounds.getRectangle(rect)) : super.getLocalBounds.call(this, rect);
}
/**
* Checks if a point is inside this tiling sprite.
* @param point - The point to check.
* @returns Whether or not the sprite contains the point.
*/
containsPoint(point) {
this.worldTransform.applyInverse(point, tempPoint);
const width = this._width, height = this._height, x1 = -width * this.anchor._x;
if (tempPoint.x >= x1 && tempPoint.x < x1 + width) {
const y1 = -height * this.anchor._y;
if (tempPoint.y >= y1 && tempPoint.y < y1 + height)
return !0;
}
return !1;
}
/**
* Destroys this sprite and optionally its texture and children
* @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
* have been set to that value
* @param {boolean} [options.children=false] - if set to true, all the children will have their destroy
* method called as well. 'options' will be passed on to those calls.
* @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well
* @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well
*/
destroy(options) {
super.destroy(options), this.tileTransform = null, this.uvMatrix = null;
}
/**
* Helper function that creates a new tiling sprite based on the source you provide.
* The source can be - frame id, image url, video url, canvas element, video element, base texture
* @static
* @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from
* @param {object} options - See {@link PIXI.BaseTexture}'s constructor for options.
* @param {number} options.width - required width of the tiling sprite
* @param {number} options.height - required height of the tiling sprite
* @returns {PIXI.TilingSprite} The newly created texture
*/
static from(source, options) {
const texture = source instanceof Texture ? source : Texture.from(source, options);
return new TilingSprite(
texture,
options.width,
options.height
);
}
/** The width of the sprite, setting this will actually modify the scale to achieve the value set. */
get width() {
return this._width;
}
set width(value) {
this._width = value;
}
/** The height of the TilingSprite, setting this will actually modify the scale to achieve the value set. */
get height() {
return this._height;
}
set height(value) {
this._height = value;
}
}
export {
TilingSprite
};
//# sourceMappingURL=TilingSprite.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,46 @@
"use strict";
var core = require("@pixi/core"), spriteTiling$1 = require("./sprite-tiling.frag.js"), spriteTiling = require("./sprite-tiling.vert.js"), spriteTilingFallback$1 = require("./sprite-tiling-fallback.frag.js"), spriteTilingFallback = require("./sprite-tiling-fallback.vert.js"), spriteTilingSimple = require("./sprite-tiling-simple.frag.js");
const tempMat = new core.Matrix();
class TilingSpriteRenderer extends core.ObjectRenderer {
/**
* constructor for renderer
* @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.
*/
constructor(renderer) {
super(renderer), renderer.runners.contextChange.add(this), this.quad = new core.QuadUv(), this.state = core.State.for2d();
}
/** Creates shaders when context is initialized. */
contextChange() {
const renderer = this.renderer, uniforms = { globals: renderer.globalUniforms };
this.simpleShader = core.Shader.from(spriteTilingFallback.default, spriteTilingSimple.default, uniforms), this.shader = renderer.context.webGLVersion > 1 ? core.Shader.from(spriteTiling.default, spriteTiling$1.default, uniforms) : core.Shader.from(spriteTilingFallback.default, spriteTilingFallback$1.default, uniforms);
}
/**
* @param {PIXI.TilingSprite} ts - tilingSprite to be rendered
*/
render(ts) {
const renderer = this.renderer, quad = this.quad;
let vertices = quad.vertices;
vertices[0] = vertices[6] = ts._width * -ts.anchor.x, vertices[1] = vertices[3] = ts._height * -ts.anchor.y, vertices[2] = vertices[4] = ts._width * (1 - ts.anchor.x), vertices[5] = vertices[7] = ts._height * (1 - ts.anchor.y);
const anchorX = ts.uvRespectAnchor ? ts.anchor.x : 0, anchorY = ts.uvRespectAnchor ? ts.anchor.y : 0;
vertices = quad.uvs, vertices[0] = vertices[6] = -anchorX, vertices[1] = vertices[3] = -anchorY, vertices[2] = vertices[4] = 1 - anchorX, vertices[5] = vertices[7] = 1 - anchorY, quad.invalidate();
const tex = ts._texture, baseTex = tex.baseTexture, premultiplied = baseTex.alphaMode > 0, lt = ts.tileTransform.localTransform, uv = ts.uvMatrix;
let isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
isSimple && (baseTex._glTextures[renderer.CONTEXT_UID] ? isSimple = baseTex.wrapMode !== core.WRAP_MODES.CLAMP : baseTex.wrapMode === core.WRAP_MODES.CLAMP && (baseTex.wrapMode = core.WRAP_MODES.REPEAT));
const shader = isSimple ? this.simpleShader : this.shader, w = tex.width, h = tex.height, W = ts._width, H = ts._height;
tempMat.set(
lt.a * w / W,
lt.b * w / H,
lt.c * h / W,
lt.d * h / H,
lt.tx / W,
lt.ty / H
), tempMat.invert(), isSimple ? tempMat.prepend(uv.mapCoord) : (shader.uniforms.uMapCoord = uv.mapCoord.toArray(!0), shader.uniforms.uClampFrame = uv.uClampFrame, shader.uniforms.uClampOffset = uv.uClampOffset), shader.uniforms.uTransform = tempMat.toArray(!0), shader.uniforms.uColor = core.Color.shared.setValue(ts.tint).premultiply(ts.worldAlpha, premultiplied).toArray(shader.uniforms.uColor), shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(!0), shader.uniforms.uSampler = tex, renderer.shader.bind(shader), renderer.geometry.bind(quad), this.state.blendMode = core.utils.correctBlendMode(ts.blendMode, premultiplied), renderer.state.set(this.state), renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);
}
}
TilingSpriteRenderer.extension = {
name: "tilingSprite",
type: core.ExtensionType.RendererPlugin
};
core.extensions.add(TilingSpriteRenderer);
exports.TilingSpriteRenderer = TilingSpriteRenderer;
//# sourceMappingURL=TilingSpriteRenderer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,52 @@
import { Matrix, ObjectRenderer, QuadUv, State, Shader, WRAP_MODES, Color, utils, ExtensionType, extensions } from "@pixi/core";
import gl2FragmentSrc from "./sprite-tiling.frag.mjs";
import gl2VertexSrc from "./sprite-tiling.vert.mjs";
import gl1FragmentSrc from "./sprite-tiling-fallback.frag.mjs";
import gl1VertexSrc from "./sprite-tiling-fallback.vert.mjs";
import fragmentSimpleSrc from "./sprite-tiling-simple.frag.mjs";
const tempMat = new Matrix();
class TilingSpriteRenderer extends ObjectRenderer {
/**
* constructor for renderer
* @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.
*/
constructor(renderer) {
super(renderer), renderer.runners.contextChange.add(this), this.quad = new QuadUv(), this.state = State.for2d();
}
/** Creates shaders when context is initialized. */
contextChange() {
const renderer = this.renderer, uniforms = { globals: renderer.globalUniforms };
this.simpleShader = Shader.from(gl1VertexSrc, fragmentSimpleSrc, uniforms), this.shader = renderer.context.webGLVersion > 1 ? Shader.from(gl2VertexSrc, gl2FragmentSrc, uniforms) : Shader.from(gl1VertexSrc, gl1FragmentSrc, uniforms);
}
/**
* @param {PIXI.TilingSprite} ts - tilingSprite to be rendered
*/
render(ts) {
const renderer = this.renderer, quad = this.quad;
let vertices = quad.vertices;
vertices[0] = vertices[6] = ts._width * -ts.anchor.x, vertices[1] = vertices[3] = ts._height * -ts.anchor.y, vertices[2] = vertices[4] = ts._width * (1 - ts.anchor.x), vertices[5] = vertices[7] = ts._height * (1 - ts.anchor.y);
const anchorX = ts.uvRespectAnchor ? ts.anchor.x : 0, anchorY = ts.uvRespectAnchor ? ts.anchor.y : 0;
vertices = quad.uvs, vertices[0] = vertices[6] = -anchorX, vertices[1] = vertices[3] = -anchorY, vertices[2] = vertices[4] = 1 - anchorX, vertices[5] = vertices[7] = 1 - anchorY, quad.invalidate();
const tex = ts._texture, baseTex = tex.baseTexture, premultiplied = baseTex.alphaMode > 0, lt = ts.tileTransform.localTransform, uv = ts.uvMatrix;
let isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
isSimple && (baseTex._glTextures[renderer.CONTEXT_UID] ? isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP : baseTex.wrapMode === WRAP_MODES.CLAMP && (baseTex.wrapMode = WRAP_MODES.REPEAT));
const shader = isSimple ? this.simpleShader : this.shader, w = tex.width, h = tex.height, W = ts._width, H = ts._height;
tempMat.set(
lt.a * w / W,
lt.b * w / H,
lt.c * h / W,
lt.d * h / H,
lt.tx / W,
lt.ty / H
), tempMat.invert(), isSimple ? tempMat.prepend(uv.mapCoord) : (shader.uniforms.uMapCoord = uv.mapCoord.toArray(!0), shader.uniforms.uClampFrame = uv.uClampFrame, shader.uniforms.uClampOffset = uv.uClampOffset), shader.uniforms.uTransform = tempMat.toArray(!0), shader.uniforms.uColor = Color.shared.setValue(ts.tint).premultiply(ts.worldAlpha, premultiplied).toArray(shader.uniforms.uColor), shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(!0), shader.uniforms.uSampler = tex, renderer.shader.bind(shader), renderer.geometry.bind(quad), this.state.blendMode = utils.correctBlendMode(ts.blendMode, premultiplied), renderer.state.set(this.state), renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);
}
}
TilingSpriteRenderer.extension = {
name: "tilingSprite",
type: ExtensionType.RendererPlugin
};
extensions.add(TilingSpriteRenderer);
export {
TilingSpriteRenderer
};
//# sourceMappingURL=TilingSpriteRenderer.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
"use strict";
var TilingSprite = require("./TilingSprite.js"), TilingSpriteRenderer = require("./TilingSpriteRenderer.js");
exports.TilingSprite = TilingSprite.TilingSprite;
exports.TilingSpriteRenderer = TilingSpriteRenderer.TilingSpriteRenderer;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

View File

@@ -0,0 +1,7 @@
import { TilingSprite } from "./TilingSprite.mjs";
import { TilingSpriteRenderer } from "./TilingSpriteRenderer.mjs";
export {
TilingSprite,
TilingSpriteRenderer
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}

View File

@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var gl1FragmentSrc = `#version 100
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#endif
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
#ifdef GL_EXT_shader_texture_lod
vec4 texSample = unclamped == coord
? texture2D(uSampler, coord)
: texture2DLodEXT(uSampler, coord, 0);
#else
vec4 texSample = texture2D(uSampler, coord);
#endif
gl_FragColor = texSample * uColor;
}
`;
exports.default = gl1FragmentSrc;
//# sourceMappingURL=sprite-tiling-fallback.frag.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-fallback.frag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,38 @@
var gl1FragmentSrc = `#version 100
#ifdef GL_EXT_shader_texture_lod
#extension GL_EXT_shader_texture_lod : enable
#endif
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
#ifdef GL_EXT_shader_texture_lod
vec4 texSample = unclamped == coord
? texture2D(uSampler, coord)
: texture2DLodEXT(uSampler, coord, 0);
#else
vec4 texSample = texture2D(uSampler, coord);
#endif
gl_FragColor = texSample * uColor;
}
`;
export {
gl1FragmentSrc as default
};
//# sourceMappingURL=sprite-tiling-fallback.frag.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-fallback.frag.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var gl1VertexSrc = `#version 100
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`;
exports.default = gl1VertexSrc;
//# sourceMappingURL=sprite-tiling-fallback.vert.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-fallback.vert.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,25 @@
var gl1VertexSrc = `#version 100
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`;
export {
gl1VertexSrc as default
};
//# sourceMappingURL=sprite-tiling-fallback.vert.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-fallback.vert.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var fragmentSimpleSrc = `#version 100
#define SHADER_NAME Tiling-Sprite-Simple-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
void main(void)
{
vec4 texSample = texture2D(uSampler, vTextureCoord);
gl_FragColor = texSample * uColor;
}
`;
exports.default = fragmentSimpleSrc;
//# sourceMappingURL=sprite-tiling-simple.frag.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-simple.frag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,20 @@
var fragmentSimpleSrc = `#version 100
#define SHADER_NAME Tiling-Sprite-Simple-100
precision lowp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 uColor;
void main(void)
{
vec4 texSample = texture2D(uSampler, vTextureCoord);
gl_FragColor = texSample * uColor;
}
`;
export {
fragmentSimpleSrc as default
};
//# sourceMappingURL=sprite-tiling-simple.frag.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling-simple.frag.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var gl2FragmentSrc = `#version 300 es
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
in vec2 vTextureCoord;
out vec4 fragmentColor;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
fragmentColor = texSample * uColor;
}
`;
exports.default = gl2FragmentSrc;
//# sourceMappingURL=sprite-tiling.frag.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling.frag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,31 @@
var gl2FragmentSrc = `#version 300 es
#define SHADER_NAME Tiling-Sprite-100
precision lowp float;
in vec2 vTextureCoord;
out vec4 fragmentColor;
uniform sampler2D uSampler;
uniform vec4 uColor;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
void main(void)
{
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
fragmentColor = texSample * uColor;
}
`;
export {
gl2FragmentSrc as default
};
//# sourceMappingURL=sprite-tiling.frag.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling.frag.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var gl2VertexSrc = `#version 300 es
#define SHADER_NAME Tiling-Sprite-300
precision lowp float;
in vec2 aVertexPosition;
in vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
out vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`;
exports.default = gl2VertexSrc;
//# sourceMappingURL=sprite-tiling.vert.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling.vert.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,25 @@
var gl2VertexSrc = `#version 300 es
#define SHADER_NAME Tiling-Sprite-300
precision lowp float;
in vec2 aVertexPosition;
in vec2 aTextureCoord;
uniform mat3 projectionMatrix;
uniform mat3 translationMatrix;
uniform mat3 uTransform;
out vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
}
`;
export {
gl2VertexSrc as default
};
//# sourceMappingURL=sprite-tiling.vert.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sprite-tiling.vert.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}