@pixi/sprite-tiling
Advanced tools
Comparing version 6.3.0 to 6.3.1
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -530,6 +530,8 @@ * @pixi/sprite-tiling is licensed under the MIT License. | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
return exports; | ||
}({}, PIXI, PIXI, PIXI, PIXI, PIXI.utils)); | ||
})({}, PIXI, PIXI, PIXI, PIXI, PIXI.utils); | ||
Object.assign(this.PIXI, _pixi_sprite_tiling); | ||
//# sourceMappingURL=sprite-tiling.js.map |
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/sprite-tiling is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_sprite_tiling=function(e,t,r,n,o,i){"use strict";var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function u(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=new r.Point,c=function(e){function n(n,o,i){void 0===o&&(o=100),void 0===i&&(i=100);var a=e.call(this,n)||this;return a.tileTransform=new r.Transform,a._width=o,a._height=i,a.uvMatrix=a.texture.uvMatrix||new t.TextureMatrix(n),a.pluginName="tilingSprite",a.uvRespectAnchor=!1,a}return u(n,e),Object.defineProperty(n.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),n.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},n.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},n.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},n.prototype.getLocalBounds=function(t){return 0===this.children.length?(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),t||(this._localBoundsRect||(this._localBoundsRect=new r.Rectangle),t=this._localBoundsRect),this._bounds.getRectangle(t)):e.prototype.getLocalBounds.call(this,t)},n.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,s);var t=this._width,r=this._height,n=-t*this.anchor._x;if(s.x>=n&&s.x<n+t){var o=-r*this.anchor._y;if(s.y>=o&&s.y<o+r)return!0}return!1},n.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},n.from=function(e,r){return new n(e instanceof t.Texture?e:t.Texture.from(e,r),r.width,r.height)},Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),n}(n.Sprite),l="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",h=new r.Matrix,d=function(e){function r(r){var n=e.call(this,r)||this;return r.runners.contextChange.add(n),n.quad=new t.QuadUv,n.state=t.State.for2d(),n}return u(r,e),r.prototype.contextChange=function(){var e=this.renderer,r={globals:e.globalUniforms};this.simpleShader=t.Shader.from(l,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",r),this.shader=e.context.webGLVersion>1?t.Shader.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",r):t.Shader.from(l,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",r)},r.prototype.render=function(e){var t=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var a=e.uvRespectAnchor?e.anchor.x:0,u=e.uvRespectAnchor?e.anchor.y:0;(n=r.uvs)[0]=n[6]=-a,n[1]=n[3]=-u,n[2]=n[4]=1-a,n[5]=n[7]=1-u,r.invalidate();var s=e._texture,c=s.baseTexture,l=e.tileTransform.localTransform,d=e.uvMatrix,p=c.isPowerOfTwo&&s.frame.width===c.width&&s.frame.height===c.height;p&&(c._glTextures[t.CONTEXT_UID]?p=c.wrapMode!==o.WRAP_MODES.CLAMP:c.wrapMode===o.WRAP_MODES.CLAMP&&(c.wrapMode=o.WRAP_MODES.REPEAT));var m=p?this.simpleShader:this.shader,f=s.width,v=s.height,_=e._width,x=e._height;h.set(l.a*f/_,l.b*f/x,l.c*v/_,l.d*v/x,l.tx/_,l.ty/x),h.invert(),p?h.prepend(d.mapCoord):(m.uniforms.uMapCoord=d.mapCoord.toArray(!0),m.uniforms.uClampFrame=d.uClampFrame,m.uniforms.uClampOffset=d.uClampOffset),m.uniforms.uTransform=h.toArray(!0),m.uniforms.uColor=i.premultiplyTintToRgba(e.tint,e.worldAlpha,m.uniforms.uColor,c.alphaMode),m.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),m.uniforms.uSampler=s,t.shader.bind(m),t.geometry.bind(r),this.state.blendMode=i.correctBlendMode(e.blendMode,c.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},r}(t.ObjectRenderer);return e.TilingSprite=c,e.TilingSpriteRenderer=d,e}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_sprite_tiling); | ||
this.PIXI=this.PIXI||{};var _pixi_sprite_tiling=function(e,t,r,n,o,i){"use strict";var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},a(e,t)};function u(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=new r.Point,c=function(e){function n(n,o,i){void 0===o&&(o=100),void 0===i&&(i=100);var a=e.call(this,n)||this;return a.tileTransform=new r.Transform,a._width=o,a._height=i,a.uvMatrix=a.texture.uvMatrix||new t.TextureMatrix(n),a.pluginName="tilingSprite",a.uvRespectAnchor=!1,a}return u(n,e),Object.defineProperty(n.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),n.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},n.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},n.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},n.prototype.getLocalBounds=function(t){return 0===this.children.length?(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),t||(this._localBoundsRect||(this._localBoundsRect=new r.Rectangle),t=this._localBoundsRect),this._bounds.getRectangle(t)):e.prototype.getLocalBounds.call(this,t)},n.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,s);var t=this._width,r=this._height,n=-t*this.anchor._x;if(s.x>=n&&s.x<n+t){var o=-r*this.anchor._y;if(s.y>=o&&s.y<o+r)return!0}return!1},n.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},n.from=function(e,r){return new n(e instanceof t.Texture?e:t.Texture.from(e,r),r.width,r.height)},Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),n}(n.Sprite),l="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",d=new r.Matrix,h=function(e){function r(r){var n=e.call(this,r)||this;return r.runners.contextChange.add(n),n.quad=new t.QuadUv,n.state=t.State.for2d(),n}return u(r,e),r.prototype.contextChange=function(){var e=this.renderer,r={globals:e.globalUniforms};this.simpleShader=t.Shader.from(l,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",r),this.shader=e.context.webGLVersion>1?t.Shader.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",r):t.Shader.from(l,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",r)},r.prototype.render=function(e){var t=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var a=e.uvRespectAnchor?e.anchor.x:0,u=e.uvRespectAnchor?e.anchor.y:0;(n=r.uvs)[0]=n[6]=-a,n[1]=n[3]=-u,n[2]=n[4]=1-a,n[5]=n[7]=1-u,r.invalidate();var s=e._texture,c=s.baseTexture,l=e.tileTransform.localTransform,h=e.uvMatrix,p=c.isPowerOfTwo&&s.frame.width===c.width&&s.frame.height===c.height;p&&(c._glTextures[t.CONTEXT_UID]?p=c.wrapMode!==o.WRAP_MODES.CLAMP:c.wrapMode===o.WRAP_MODES.CLAMP&&(c.wrapMode=o.WRAP_MODES.REPEAT));var m=p?this.simpleShader:this.shader,f=s.width,v=s.height,_=e._width,x=e._height;d.set(l.a*f/_,l.b*f/x,l.c*v/_,l.d*v/x,l.tx/_,l.ty/x),d.invert(),p?d.prepend(h.mapCoord):(m.uniforms.uMapCoord=h.mapCoord.toArray(!0),m.uniforms.uClampFrame=h.uClampFrame,m.uniforms.uClampOffset=h.uClampOffset),m.uniforms.uTransform=d.toArray(!0),m.uniforms.uColor=i.premultiplyTintToRgba(e.tint,e.worldAlpha,m.uniforms.uColor,c.alphaMode),m.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),m.uniforms.uSampler=s,t.shader.bind(m),t.geometry.bind(r),this.state.blendMode=i.correctBlendMode(e.blendMode,c.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},r}(t.ObjectRenderer);return e.TilingSprite=c,e.TilingSpriteRenderer=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_sprite_tiling); | ||
//# sourceMappingURL=sprite-tiling.min.js.map |
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -5,0 +5,0 @@ * @pixi/sprite-tiling is licensed under the MIT License. |
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/sprite-tiling is licensed under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),math=require("@pixi/math"),sprite=require("@pixi/sprite"),constants=require("@pixi/constants"),utils=require("@pixi/utils"),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function __extends(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var tempPoint=new math.Point,TilingSprite=function(e){function t(t,r,n){void 0===r&&(r=100),void 0===n&&(n=100);var o=e.call(this,t)||this;return o.tileTransform=new math.Transform,o._width=r,o._height=n,o.uvMatrix=o.texture.uvMatrix||new core.TextureMatrix(t),o.pluginName="tilingSprite",o.uvRespectAnchor=!1,o}return __extends(t,e),Object.defineProperty(t.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),t.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},t.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},t.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},t.prototype.getLocalBounds=function(t){return 0===this.children.length?(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),t||(this._localBoundsRect||(this._localBoundsRect=new math.Rectangle),t=this._localBoundsRect),this._bounds.getRectangle(t)):e.prototype.getLocalBounds.call(this,t)},t.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,tempPoint);var t=this._width,r=this._height,n=-t*this.anchor._x;if(tempPoint.x>=n&&tempPoint.x<n+t){var o=-r*this.anchor._y;if(tempPoint.y>=o&&tempPoint.y<o+r)return!0}return!1},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.tileTransform=null,this.uvMatrix=null},t.from=function(e,r){return new t(e instanceof core.Texture?e:core.Texture.from(e,r),r.width,r.height)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),t}(sprite.Sprite),fragmentSimpleSrc="#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",gl1VertexSrc="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",gl1FragmentSrc="#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",gl2VertexSrc="#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",gl2FragmentSrc="#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",tempMat=new math.Matrix,TilingSpriteRenderer=function(e){function t(t){var r=e.call(this,t)||this;return t.runners.contextChange.add(r),r.quad=new core.QuadUv,r.state=core.State.for2d(),r}return __extends(t,e),t.prototype.contextChange=function(){var e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=core.Shader.from(gl1VertexSrc,fragmentSimpleSrc,t),this.shader=e.context.webGLVersion>1?core.Shader.from(gl2VertexSrc,gl2FragmentSrc,t):core.Shader.from(gl1VertexSrc,gl1FragmentSrc,t)},t.prototype.render=function(e){var t=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var o=e.uvRespectAnchor?e.anchor.x:0,i=e.uvRespectAnchor?e.anchor.y:0;(n=r.uvs)[0]=n[6]=-o,n[1]=n[3]=-i,n[2]=n[4]=1-o,n[5]=n[7]=1-i,r.invalidate();var a=e._texture,s=a.baseTexture,u=e.tileTransform.localTransform,c=e.uvMatrix,l=s.isPowerOfTwo&&a.frame.width===s.width&&a.frame.height===s.height;l&&(s._glTextures[t.CONTEXT_UID]?l=s.wrapMode!==constants.WRAP_MODES.CLAMP:s.wrapMode===constants.WRAP_MODES.CLAMP&&(s.wrapMode=constants.WRAP_MODES.REPEAT));var p=l?this.simpleShader:this.shader,d=a.width,m=a.height,h=e._width,f=e._height;tempMat.set(u.a*d/h,u.b*d/f,u.c*m/h,u.d*m/f,u.tx/h,u.ty/f),tempMat.invert(),l?tempMat.prepend(c.mapCoord):(p.uniforms.uMapCoord=c.mapCoord.toArray(!0),p.uniforms.uClampFrame=c.uClampFrame,p.uniforms.uClampOffset=c.uClampOffset),p.uniforms.uTransform=tempMat.toArray(!0),p.uniforms.uColor=utils.premultiplyTintToRgba(e.tint,e.worldAlpha,p.uniforms.uColor,s.alphaMode),p.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),p.uniforms.uSampler=a,t.shader.bind(p),t.geometry.bind(r),this.state.blendMode=utils.correctBlendMode(e.blendMode,s.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},t}(core.ObjectRenderer);exports.TilingSprite=TilingSprite,exports.TilingSpriteRenderer=TilingSpriteRenderer; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/core"),t=require("@pixi/math"),r=require("@pixi/sprite"),n=require("@pixi/constants"),o=require("@pixi/utils"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},i(e,t)};function a(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=new t.Point,s=function(r){function n(n,o,i){void 0===o&&(o=100),void 0===i&&(i=100);var a=r.call(this,n)||this;return a.tileTransform=new t.Transform,a._width=o,a._height=i,a.uvMatrix=a.texture.uvMatrix||new e.TextureMatrix(n),a.pluginName="tilingSprite",a.uvRespectAnchor=!1,a}return a(n,r),Object.defineProperty(n.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),n.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},n.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},n.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},n.prototype.getLocalBounds=function(e){return 0===this.children.length?(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),e||(this._localBoundsRect||(this._localBoundsRect=new t.Rectangle),e=this._localBoundsRect),this._bounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},n.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,u);var t=this._width,r=this._height,n=-t*this.anchor._x;if(u.x>=n&&u.x<n+t){var o=-r*this.anchor._y;if(u.y>=o&&u.y<o+r)return!0}return!1},n.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},n.from=function(t,r){return new n(t instanceof e.Texture?t:e.Texture.from(t,r),r.width,r.height)},Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),n}(r.Sprite),c="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",l=new t.Matrix,d=function(t){function r(r){var n=t.call(this,r)||this;return r.runners.contextChange.add(n),n.quad=new e.QuadUv,n.state=e.State.for2d(),n}return a(r,t),r.prototype.contextChange=function(){var t=this.renderer,r={globals:t.globalUniforms};this.simpleShader=e.Shader.from(c,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",r),this.shader=t.context.webGLVersion>1?e.Shader.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",r):e.Shader.from(c,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",r)},r.prototype.render=function(e){var t=this.renderer,r=this.quad,i=r.vertices;i[0]=i[6]=e._width*-e.anchor.x,i[1]=i[3]=e._height*-e.anchor.y,i[2]=i[4]=e._width*(1-e.anchor.x),i[5]=i[7]=e._height*(1-e.anchor.y);var a=e.uvRespectAnchor?e.anchor.x:0,u=e.uvRespectAnchor?e.anchor.y:0;(i=r.uvs)[0]=i[6]=-a,i[1]=i[3]=-u,i[2]=i[4]=1-a,i[5]=i[7]=1-u,r.invalidate();var s=e._texture,c=s.baseTexture,d=e.tileTransform.localTransform,h=e.uvMatrix,p=c.isPowerOfTwo&&s.frame.width===c.width&&s.frame.height===c.height;p&&(c._glTextures[t.CONTEXT_UID]?p=c.wrapMode!==n.WRAP_MODES.CLAMP:c.wrapMode===n.WRAP_MODES.CLAMP&&(c.wrapMode=n.WRAP_MODES.REPEAT));var m=p?this.simpleShader:this.shader,f=s.width,v=s.height,x=e._width,_=e._height;l.set(d.a*f/x,d.b*f/_,d.c*v/x,d.d*v/_,d.tx/x,d.ty/_),l.invert(),p?l.prepend(h.mapCoord):(m.uniforms.uMapCoord=h.mapCoord.toArray(!0),m.uniforms.uClampFrame=h.uClampFrame,m.uniforms.uClampOffset=h.uClampOffset),m.uniforms.uTransform=l.toArray(!0),m.uniforms.uColor=o.premultiplyTintToRgba(e.tint,e.worldAlpha,m.uniforms.uColor,c.alphaMode),m.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),m.uniforms.uSampler=s,t.shader.bind(m),t.geometry.bind(r),this.state.blendMode=o.correctBlendMode(e.blendMode,c.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},r}(e.ObjectRenderer);exports.TilingSprite=s,exports.TilingSpriteRenderer=d; | ||
//# sourceMappingURL=sprite-tiling.min.js.map |
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -5,0 +5,0 @@ * @pixi/sprite-tiling is licensed under the MIT License. |
/*! | ||
* @pixi/sprite-tiling - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/sprite-tiling - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/sprite-tiling is licensed under the MIT License. | ||
*/ | ||
import{Texture as e,TextureMatrix as t,Shader as r,QuadUv as n,State as o,ObjectRenderer as i}from"@pixi/core";import{Point as a,Rectangle as u,Transform as s,Matrix as c}from"@pixi/math";import{Sprite as l}from"@pixi/sprite";import{WRAP_MODES as h}from"@pixi/constants";import{premultiplyTintToRgba as p,correctBlendMode as d}from"@pixi/utils";var m=function(e,t){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function f(e,t){function r(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var v=new a,x=function(r){function n(e,n,o){void 0===n&&(n=100),void 0===o&&(o=100);var i=r.call(this,e)||this;return i.tileTransform=new s,i._width=n,i._height=o,i.uvMatrix=i.texture.uvMatrix||new t(e),i.pluginName="tilingSprite",i.uvRespectAnchor=!1,i}return f(n,r),Object.defineProperty(n.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),n.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},n.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},n.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},n.prototype.getLocalBounds=function(e){return 0===this.children.length?(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),e||(this._localBoundsRect||(this._localBoundsRect=new u),e=this._localBoundsRect),this._bounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},n.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,v);var t=this._width,r=this._height,n=-t*this.anchor._x;if(v.x>=n&&v.x<n+t){var o=-r*this.anchor._y;if(v.y>=o&&v.y<o+r)return!0}return!1},n.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},n.from=function(t,r){return new n(t instanceof e?t:e.from(t,r),r.width,r.height)},Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),n}(l),_="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",g=new c,y=function(e){function t(t){var r=e.call(this,t)||this;return t.runners.contextChange.add(r),r.quad=new n,r.state=o.for2d(),r}return f(t,e),t.prototype.contextChange=function(){var e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=r.from(_,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",t),this.shader=e.context.webGLVersion>1?r.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",t):r.from(_,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",t)},t.prototype.render=function(e){var t=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var o=e.uvRespectAnchor?e.anchor.x:0,i=e.uvRespectAnchor?e.anchor.y:0;(n=r.uvs)[0]=n[6]=-o,n[1]=n[3]=-i,n[2]=n[4]=1-o,n[5]=n[7]=1-i,r.invalidate();var a=e._texture,u=a.baseTexture,s=e.tileTransform.localTransform,c=e.uvMatrix,l=u.isPowerOfTwo&&a.frame.width===u.width&&a.frame.height===u.height;l&&(u._glTextures[t.CONTEXT_UID]?l=u.wrapMode!==h.CLAMP:u.wrapMode===h.CLAMP&&(u.wrapMode=h.REPEAT));var m=l?this.simpleShader:this.shader,f=a.width,v=a.height,x=e._width,_=e._height;g.set(s.a*f/x,s.b*f/_,s.c*v/x,s.d*v/_,s.tx/x,s.ty/_),g.invert(),l?g.prepend(c.mapCoord):(m.uniforms.uMapCoord=c.mapCoord.toArray(!0),m.uniforms.uClampFrame=c.uClampFrame,m.uniforms.uClampOffset=c.uClampOffset),m.uniforms.uTransform=g.toArray(!0),m.uniforms.uColor=p(e.tint,e.worldAlpha,m.uniforms.uColor,u.alphaMode),m.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),m.uniforms.uSampler=a,t.shader.bind(m),t.geometry.bind(r),this.state.blendMode=d(e.blendMode,u.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},t}(i);export{x as TilingSprite,y as TilingSpriteRenderer}; | ||
import{Texture as e,TextureMatrix as t,Shader as r,QuadUv as n,State as o,ObjectRenderer as i}from"@pixi/core";import{Point as a,Rectangle as u,Transform as s,Matrix as c}from"@pixi/math";import{Sprite as l}from"@pixi/sprite";import{WRAP_MODES as h}from"@pixi/constants";import{premultiplyTintToRgba as p,correctBlendMode as d}from"@pixi/utils";var m=function(e,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},m(e,t)};function f(e,t){function r(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var v=new a,x=function(r){function n(e,n,o){void 0===n&&(n=100),void 0===o&&(o=100);var i=r.call(this,e)||this;return i.tileTransform=new s,i._width=n,i._height=o,i.uvMatrix=i.texture.uvMatrix||new t(e),i.pluginName="tilingSprite",i.uvRespectAnchor=!1,i}return f(n,r),Object.defineProperty(n.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(e){this.tileTransform.scale.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(e){this.tileTransform.position.copyFrom(e)},enumerable:!1,configurable:!0}),n.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},n.prototype._render=function(e){var t=this._texture;t&&t.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))},n.prototype._calculateBounds=function(){var e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,r=this._width*(1-this._anchor._x),n=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,r,n)},n.prototype.getLocalBounds=function(e){return 0===this.children.length?(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),e||(this._localBoundsRect||(this._localBoundsRect=new u),e=this._localBoundsRect),this._bounds.getRectangle(e)):r.prototype.getLocalBounds.call(this,e)},n.prototype.containsPoint=function(e){this.worldTransform.applyInverse(e,v);var t=this._width,r=this._height,n=-t*this.anchor._x;if(v.x>=n&&v.x<n+t){var o=-r*this.anchor._y;if(v.y>=o&&v.y<o+r)return!0}return!1},n.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.tileTransform=null,this.uvMatrix=null},n.from=function(t,r){return new n(t instanceof e?t:e.from(t,r),r.width,r.height)},Object.defineProperty(n.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!1,configurable:!0}),n}(l),_="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",g=new c,y=function(e){function t(t){var r=e.call(this,t)||this;return t.runners.contextChange.add(r),r.quad=new n,r.state=o.for2d(),r}return f(t,e),t.prototype.contextChange=function(){var e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=r.from(_,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",t),this.shader=e.context.webGLVersion>1?r.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",t):r.from(_,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",t)},t.prototype.render=function(e){var t=this.renderer,r=this.quad,n=r.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var o=e.uvRespectAnchor?e.anchor.x:0,i=e.uvRespectAnchor?e.anchor.y:0;(n=r.uvs)[0]=n[6]=-o,n[1]=n[3]=-i,n[2]=n[4]=1-o,n[5]=n[7]=1-i,r.invalidate();var a=e._texture,u=a.baseTexture,s=e.tileTransform.localTransform,c=e.uvMatrix,l=u.isPowerOfTwo&&a.frame.width===u.width&&a.frame.height===u.height;l&&(u._glTextures[t.CONTEXT_UID]?l=u.wrapMode!==h.CLAMP:u.wrapMode===h.CLAMP&&(u.wrapMode=h.REPEAT));var m=l?this.simpleShader:this.shader,f=a.width,v=a.height,x=e._width,_=e._height;g.set(s.a*f/x,s.b*f/_,s.c*v/x,s.d*v/_,s.tx/x,s.ty/_),g.invert(),l?g.prepend(c.mapCoord):(m.uniforms.uMapCoord=c.mapCoord.toArray(!0),m.uniforms.uClampFrame=c.uClampFrame,m.uniforms.uClampOffset=c.uClampOffset),m.uniforms.uTransform=g.toArray(!0),m.uniforms.uColor=p(e.tint,e.worldAlpha,m.uniforms.uColor,u.alphaMode),m.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),m.uniforms.uSampler=a,t.shader.bind(m),t.geometry.bind(r),this.state.blendMode=d(e.blendMode,u.alphaMode),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},t}(i);export{x as TilingSprite,y as TilingSpriteRenderer}; | ||
//# sourceMappingURL=sprite-tiling.min.js.map |
{ | ||
"name": "@pixi/sprite-tiling", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"main": "dist/cjs/sprite-tiling.js", | ||
@@ -28,10 +28,10 @@ "module": "dist/esm/sprite-tiling.js", | ||
"peerDependencies": { | ||
"@pixi/constants": "6.3.0", | ||
"@pixi/core": "6.3.0", | ||
"@pixi/display": "6.3.0", | ||
"@pixi/math": "6.3.0", | ||
"@pixi/sprite": "6.3.0", | ||
"@pixi/utils": "6.3.0" | ||
"@pixi/constants": "6.3.1", | ||
"@pixi/core": "6.3.1", | ||
"@pixi/display": "6.3.1", | ||
"@pixi/math": "6.3.1", | ||
"@pixi/sprite": "6.3.1", | ||
"@pixi/utils": "6.3.1" | ||
}, | ||
"gitHead": "dc311cdd7a28e6817556cdc674fd15ef71069467" | ||
"gitHead": "a520915d81f307c40fcbad5d877b0f2de465c4bf" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299558
1495