Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/mesh

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/mesh - npm Package Compare versions

Comparing version 6.1.3 to 6.2.0

45

dist/browser/mesh.js
/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -290,11 +290,3 @@ * @pixi/mesh is licensed under the MIT License.

var _this = _super.call(this) || this;
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
* @readonly
*/
_this.geometry = geometry;
geometry.refCount++;
/**

@@ -372,2 +364,31 @@ * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.

}
Object.defineProperty(Mesh.prototype, "geometry", {
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
*/
get: function () {
return this._geometry;
},
set: function (value) {
if (this._geometry === value) {
return;
}
if (this._geometry) {
this._geometry.refCount--;
if (this._geometry.refCount === 0) {
this._geometry.dispose();
}
}
this._geometry = value;
if (this._geometry) {
this._geometry.refCount++;
}
this.vertexDirty = -1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Mesh.prototype, "uvBuffer", {

@@ -655,6 +676,2 @@ /**

_super.prototype.destroy.call(this, options);
this.geometry.refCount--;
if (this.geometry.refCount === 0) {
this.geometry.dispose();
}
if (this._cachedTexture) {

@@ -661,0 +678,0 @@ this._cachedTexture.destroy();

/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mesh is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_mesh=function(t,e,r,i,n,a,o){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function u(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),l=new r.Point,f=new r.Polygon,d=function(t){function r(r,n,o,s){void 0===s&&(s=i.DRAW_MODES.TRIANGLES);var u=t.call(this)||this;return u.geometry=r,r.refCount++,u.shader=n,u.state=o||e.State.for2d(),u.drawMode=s,u.start=0,u.size=0,u.uvs=null,u.indices=null,u.vertexData=new Float32Array(1),u.vertexDirty=-1,u._transformID=-1,u._roundPixels=a.settings.ROUND_PIXELS,u.batchUvs=null,u}return u(r,t),Object.defineProperty(r.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){var e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===i.DRAW_MODES.TRIANGLES&&e.length<2*r.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},r.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},r.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},r.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,o=i.b,s=i.c,u=i.d,h=i.tx,l=i.ty,f=this.vertexData,d=0;d<f.length/2;d++){var c=e[2*d],p=e[2*d+1];f[2*d]=n*c+s*p+h,f[2*d+1]=o*c+u*p+l}if(this._roundPixels){var y=a.settings.RESOLUTION;for(d=0;d<f.length;++d)f[d]=Math.round((f[d]*y|0)/y)}this.vertexDirty=r}},r.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new h(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},r.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},r.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,l);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=f.points,i=this.geometry.getIndex().data,n=i.length,a=4===this.drawMode?3:1,o=0;o+2<n;o+=a){var s=2*i[o],u=2*i[o+1],h=2*i[o+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],f.contains(l.x,l.y))return!0}return!1},r.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},r.BATCHABLE_SIZE=100,r}(n.Container),c="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",p="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",y=function(t){function i(i,n){var a=this,o={uSampler:i,alpha:1,uTextureMatrix:r.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(n=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},n)).uniforms&&Object.assign(o,n.uniforms),(a=t.call(this,n.program||e.Program.from(p,c),o)||this)._colorDirty=!1,a.uvMatrix=new e.TextureMatrix(i),a.batchable=void 0===n.program,a.pluginName=n.pluginName,a.tint=n.tint,a.alpha=n.alpha,a}return u(i,t),Object.defineProperty(i.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),i.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;o.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},i}(e.Shader),x=function(t){function r(r,n,a){var o=t.call(this)||this,s=new e.Buffer(r),u=new e.Buffer(n,!0),h=new e.Buffer(a,!0,!0);return o.addAttribute("aVertexPosition",s,2,!1,i.TYPES.FLOAT).addAttribute("aTextureCoord",u,2,!1,i.TYPES.FLOAT).addIndex(h),o._updateId=-1,o}return u(r,t),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(e.Geometry);return t.Mesh=d,t.MeshBatchUvs=h,t.MeshGeometry=x,t.MeshMaterial=y,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_mesh);
this.PIXI=this.PIXI||{};var _pixi_mesh=function(t,e,r,i,n,a,o){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function u(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),l=new r.Point,f=new r.Polygon,d=function(t){function r(r,n,o,s){void 0===s&&(s=i.DRAW_MODES.TRIANGLES);var u=t.call(this)||this;return u.geometry=r,u.shader=n,u.state=o||e.State.for2d(),u.drawMode=s,u.start=0,u.size=0,u.uvs=null,u.indices=null,u.vertexData=new Float32Array(1),u.vertexDirty=-1,u._transformID=-1,u._roundPixels=a.settings.ROUND_PIXELS,u.batchUvs=null,u}return u(r,t),Object.defineProperty(r.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){var e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===i.DRAW_MODES.TRIANGLES&&e.length<2*r.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},r.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},r.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},r.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,o=i.b,s=i.c,u=i.d,h=i.tx,l=i.ty,f=this.vertexData,d=0;d<f.length/2;d++){var c=e[2*d],p=e[2*d+1];f[2*d]=n*c+s*p+h,f[2*d+1]=o*c+u*p+l}if(this._roundPixels){var y=a.settings.RESOLUTION;for(d=0;d<f.length;++d)f[d]=Math.round((f[d]*y|0)/y)}this.vertexDirty=r}},r.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new h(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},r.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},r.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,l);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=f.points,i=this.geometry.getIndex().data,n=i.length,a=4===this.drawMode?3:1,o=0;o+2<n;o+=a){var s=2*i[o],u=2*i[o+1],h=2*i[o+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],f.contains(l.x,l.y))return!0}return!1},r.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},r.BATCHABLE_SIZE=100,r}(n.Container),c="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",p="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",y=function(t){function i(i,n){var a=this,o={uSampler:i,alpha:1,uTextureMatrix:r.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(n=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},n)).uniforms&&Object.assign(o,n.uniforms),(a=t.call(this,n.program||e.Program.from(p,c),o)||this)._colorDirty=!1,a.uvMatrix=new e.TextureMatrix(i),a.batchable=void 0===n.program,a.pluginName=n.pluginName,a.tint=n.tint,a.alpha=n.alpha,a}return u(i,t),Object.defineProperty(i.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),i.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;o.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},i}(e.Shader),m=function(t){function r(r,n,a){var o=t.call(this)||this,s=new e.Buffer(r),u=new e.Buffer(n,!0),h=new e.Buffer(a,!0,!0);return o.addAttribute("aVertexPosition",s,2,!1,i.TYPES.FLOAT).addAttribute("aTextureCoord",u,2,!1,i.TYPES.FLOAT).addIndex(h),o._updateId=-1,o}return u(r,t),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(e.Geometry);return t.Mesh=d,t.MeshBatchUvs=h,t.MeshGeometry=m,t.MeshMaterial=y,t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_mesh);
//# sourceMappingURL=mesh.min.js.map
/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -135,11 +135,3 @@ * @pixi/mesh is licensed under the MIT License.

var _this = _super.call(this) || this;
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
* @readonly
*/
_this.geometry = geometry;
geometry.refCount++;
/**

@@ -217,2 +209,31 @@ * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.

}
Object.defineProperty(Mesh.prototype, "geometry", {
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
*/
get: function () {
return this._geometry;
},
set: function (value) {
if (this._geometry === value) {
return;
}
if (this._geometry) {
this._geometry.refCount--;
if (this._geometry.refCount === 0) {
this._geometry.dispose();
}
}
this._geometry = value;
if (this._geometry) {
this._geometry.refCount++;
}
this.vertexDirty = -1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Mesh.prototype, "uvBuffer", {

@@ -500,6 +521,2 @@ /**

_super.prototype.destroy.call(this, options);
this.geometry.refCount--;
if (this.geometry.refCount === 0) {
this.geometry.dispose();
}
if (this._cachedTexture) {

@@ -506,0 +523,0 @@ this._cachedTexture.destroy();

/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mesh is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),math=require("@pixi/math"),constants=require("@pixi/constants"),display=require("@pixi/display"),settings=require("@pixi/settings"),utils=require("@pixi/utils"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var MeshBatchUvs=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),tempPoint=new math.Point,tempPolygon=new math.Polygon,Mesh=function(t){function e(e,r,i,n){void 0===n&&(n=constants.DRAW_MODES.TRIANGLES);var a=t.call(this)||this;return a.geometry=e,e.refCount++,a.shader=r,a.state=i||core.State.for2d(),a.drawMode=n,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=settings.settings.ROUND_PIXELS,a.batchUvs=null,a}return __extends(e,t),Object.defineProperty(e.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){var r=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===constants.DRAW_MODES.TRIANGLES&&r.length<2*e.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},e.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},e.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},e.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,a=i.b,o=i.c,s=i.d,u=i.tx,h=i.ty,l=this.vertexData,d=0;d<l.length/2;d++){var c=e[2*d],f=e[2*d+1];l[2*d]=n*c+o*f+u,l[2*d+1]=a*c+s*f+h}if(this._roundPixels){var p=settings.settings.RESOLUTION;for(d=0;d<l.length;++d)l[d]=Math.round((l[d]*p|0)/p)}this.vertexDirty=r}},e.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new MeshBatchUvs(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},e.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,tempPoint);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=tempPolygon.points,i=this.geometry.getIndex().data,n=i.length,a=4===this.drawMode?3:1,o=0;o+2<n;o+=a){var s=2*i[o],u=2*i[o+1],h=2*i[o+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],tempPolygon.contains(tempPoint.x,tempPoint.y))return!0}return!1},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},e.BATCHABLE_SIZE=100,e}(display.Container),fragment="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",vertex="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",MeshMaterial=function(t){function e(e,r){var i=this,n={uSampler:e,alpha:1,uTextureMatrix:math.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(r=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},r)).uniforms&&Object.assign(n,r.uniforms),(i=t.call(this,r.program||core.Program.from(vertex,fragment),n)||this)._colorDirty=!1,i.uvMatrix=new core.TextureMatrix(e),i.batchable=void 0===r.program,i.pluginName=r.pluginName,i.tint=r.tint,i.alpha=r.alpha,i}return __extends(e,t),Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;utils.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(core.Shader),MeshGeometry=function(t){function e(e,r,i){var n=t.call(this)||this,a=new core.Buffer(e),o=new core.Buffer(r,!0),s=new core.Buffer(i,!0,!0);return n.addAttribute("aVertexPosition",a,2,!1,constants.TYPES.FLOAT).addAttribute("aTextureCoord",o,2,!1,constants.TYPES.FLOAT).addIndex(s),n._updateId=-1,n}return __extends(e,t),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(core.Geometry);exports.Mesh=Mesh,exports.MeshBatchUvs=MeshBatchUvs,exports.MeshGeometry=MeshGeometry,exports.MeshMaterial=MeshMaterial;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@pixi/core"),math=require("@pixi/math"),constants=require("@pixi/constants"),display=require("@pixi/display"),settings=require("@pixi/settings"),utils=require("@pixi/utils"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var MeshBatchUvs=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),tempPoint=new math.Point,tempPolygon=new math.Polygon,Mesh=function(t){function e(e,r,i,n){void 0===n&&(n=constants.DRAW_MODES.TRIANGLES);var o=t.call(this)||this;return o.geometry=e,o.shader=r,o.state=i||core.State.for2d(),o.drawMode=n,o.start=0,o.size=0,o.uvs=null,o.indices=null,o.vertexData=new Float32Array(1),o.vertexDirty=-1,o._transformID=-1,o._roundPixels=settings.settings.ROUND_PIXELS,o.batchUvs=null,o}return __extends(e,t),Object.defineProperty(e.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),e.prototype._render=function(t){var r=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===constants.DRAW_MODES.TRIANGLES&&r.length<2*e.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},e.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},e.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},e.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,o=i.b,a=i.c,s=i.d,u=i.tx,h=i.ty,l=this.vertexData,c=0;c<l.length/2;c++){var d=e[2*c],f=e[2*c+1];l[2*c]=n*d+a*f+u,l[2*c+1]=o*d+s*f+h}if(this._roundPixels){var p=settings.settings.RESOLUTION;for(c=0;c<l.length;++c)l[c]=Math.round((l[c]*p|0)/p)}this.vertexDirty=r}},e.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new MeshBatchUvs(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},e.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},e.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,tempPoint);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=tempPolygon.points,i=this.geometry.getIndex().data,n=i.length,o=4===this.drawMode?3:1,a=0;a+2<n;a+=o){var s=2*i[a],u=2*i[a+1],h=2*i[a+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],tempPolygon.contains(tempPoint.x,tempPoint.y))return!0}return!1},e.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},e.BATCHABLE_SIZE=100,e}(display.Container),fragment="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",vertex="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",MeshMaterial=function(t){function e(e,r){var i=this,n={uSampler:e,alpha:1,uTextureMatrix:math.Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(r=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},r)).uniforms&&Object.assign(n,r.uniforms),(i=t.call(this,r.program||core.Program.from(vertex,fragment),n)||this)._colorDirty=!1,i.uvMatrix=new core.TextureMatrix(e),i.batchable=void 0===r.program,i.pluginName=r.pluginName,i.tint=r.tint,i.alpha=r.alpha,i}return __extends(e,t),Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;utils.premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(core.Shader),MeshGeometry=function(t){function e(e,r,i){var n=t.call(this)||this,o=new core.Buffer(e),a=new core.Buffer(r,!0),s=new core.Buffer(i,!0,!0);return n.addAttribute("aVertexPosition",o,2,!1,constants.TYPES.FLOAT).addAttribute("aTextureCoord",a,2,!1,constants.TYPES.FLOAT).addIndex(s),n._updateId=-1,n}return __extends(e,t),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(core.Geometry);exports.Mesh=Mesh,exports.MeshBatchUvs=MeshBatchUvs,exports.MeshGeometry=MeshGeometry,exports.MeshMaterial=MeshMaterial;
//# sourceMappingURL=mesh.min.js.map
/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -131,11 +131,3 @@ * @pixi/mesh is licensed under the MIT License.

var _this = _super.call(this) || this;
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
* @readonly
*/
_this.geometry = geometry;
geometry.refCount++;
/**

@@ -213,2 +205,31 @@ * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.

}
Object.defineProperty(Mesh.prototype, "geometry", {
/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
*/
get: function () {
return this._geometry;
},
set: function (value) {
if (this._geometry === value) {
return;
}
if (this._geometry) {
this._geometry.refCount--;
if (this._geometry.refCount === 0) {
this._geometry.dispose();
}
}
this._geometry = value;
if (this._geometry) {
this._geometry.refCount++;
}
this.vertexDirty = -1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Mesh.prototype, "uvBuffer", {

@@ -496,6 +517,2 @@ /**

_super.prototype.destroy.call(this, options);
this.geometry.refCount--;
if (this.geometry.refCount === 0) {
this.geometry.dispose();
}
if (this._cachedTexture) {

@@ -502,0 +519,0 @@ this._cachedTexture.destroy();

/*!
* @pixi/mesh - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/mesh - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/mesh is licensed under the MIT License.

*/
import{State as t,Program as e,TextureMatrix as r,Shader as i,Buffer as n,Geometry as a}from"@pixi/core";import{Point as o,Polygon as s,Matrix as u}from"@pixi/math";import{DRAW_MODES as h,TYPES as l}from"@pixi/constants";import{Container as d}from"@pixi/display";import{settings as f}from"@pixi/settings";import{premultiplyTintToRgba as p}from"@pixi/utils";var c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function m(t,e){function r(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var x=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),y=new o,v=new s,b=function(e){function r(r,i,n,a){void 0===a&&(a=h.TRIANGLES);var o=e.call(this)||this;return o.geometry=r,r.refCount++,o.shader=i,o.state=n||t.for2d(),o.drawMode=a,o.start=0,o.size=0,o.uvs=null,o.indices=null,o.vertexData=new Float32Array(1),o.vertexDirty=-1,o._transformID=-1,o._roundPixels=f.ROUND_PIXELS,o.batchUvs=null,o}return m(r,e),Object.defineProperty(r.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){var e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===h.TRIANGLES&&e.length<2*r.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},r.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},r.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},r.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,a=i.b,o=i.c,s=i.d,u=i.tx,h=i.ty,l=this.vertexData,d=0;d<l.length/2;d++){var p=e[2*d],c=e[2*d+1];l[2*d]=n*p+o*c+u,l[2*d+1]=a*p+s*c+h}if(this._roundPixels){var m=f.RESOLUTION;for(d=0;d<l.length;++d)l[d]=Math.round((l[d]*m|0)/m)}this.vertexDirty=r}},r.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new x(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},r.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},r.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,y);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=v.points,i=this.geometry.getIndex().data,n=i.length,a=4===this.drawMode?3:1,o=0;o+2<n;o+=a){var s=2*i[o],u=2*i[o+1],h=2*i[o+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],v.contains(y.x,y.y))return!0}return!1},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},r.BATCHABLE_SIZE=100,r}(d),g="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",_="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",D=function(t){function i(i,n){var a=this,o={uSampler:i,alpha:1,uTextureMatrix:u.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(n=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},n)).uniforms&&Object.assign(o,n.uniforms),(a=t.call(this,n.program||e.from(_,g),o)||this)._colorDirty=!1,a.uvMatrix=new r(i),a.batchable=void 0===n.program,a.pluginName=n.pluginName,a.tint=n.tint,a.alpha=n.alpha,a}return m(i,t),Object.defineProperty(i.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),i.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;p(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},i}(i),I=function(t){function e(e,r,i){var a=t.call(this)||this,o=new n(e),s=new n(r,!0),u=new n(i,!0,!0);return a.addAttribute("aVertexPosition",o,2,!1,l.FLOAT).addAttribute("aTextureCoord",s,2,!1,l.FLOAT).addIndex(u),a._updateId=-1,a}return m(e,t),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(a);export{b as Mesh,x as MeshBatchUvs,I as MeshGeometry,D as MeshMaterial};
import{State as t,Program as e,TextureMatrix as r,Shader as i,Buffer as n,Geometry as o}from"@pixi/core";import{Point as a,Polygon as s,Matrix as u}from"@pixi/math";import{DRAW_MODES as h,TYPES as l}from"@pixi/constants";import{Container as f}from"@pixi/display";import{settings as d}from"@pixi/settings";import{premultiplyTintToRgba as c}from"@pixi/utils";var p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function m(t,e){function r(){this.constructor=t}p(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var y=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),x=new a,v=new s,g=function(e){function r(r,i,n,o){void 0===o&&(o=h.TRIANGLES);var a=e.call(this)||this;return a.geometry=r,a.shader=i,a.state=n||t.for2d(),a.drawMode=o,a.start=0,a.size=0,a.uvs=null,a.indices=null,a.vertexData=new Float32Array(1),a.vertexDirty=-1,a._transformID=-1,a._roundPixels=d.ROUND_PIXELS,a.batchUvs=null,a}return m(r,e),Object.defineProperty(r.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){var e=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===h.TRIANGLES&&e.length<2*r.BATCHABLE_SIZE?this._renderToBatch(t):this._renderDefault(t)},r.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},r.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},r.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,o=i.b,a=i.c,s=i.d,u=i.tx,h=i.ty,l=this.vertexData,f=0;f<l.length/2;f++){var c=e[2*f],p=e[2*f+1];l[2*f]=n*c+a*p+u,l[2*f+1]=o*c+s*p+h}if(this._roundPixels){var m=d.RESOLUTION;for(f=0;f<l.length;++f)l[f]=Math.round((l[f]*m|0)/m)}this.vertexDirty=r}},r.prototype.calculateUvs=function(){var t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new y(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},r.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},r.prototype.containsPoint=function(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,x);for(var e=this.geometry.getBuffer("aVertexPosition").data,r=v.points,i=this.geometry.getIndex().data,n=i.length,o=4===this.drawMode?3:1,a=0;a+2<n;a+=o){var s=2*i[a],u=2*i[a+1],h=2*i[a+2];if(r[0]=e[s],r[1]=e[s+1],r[2]=e[u],r[3]=e[u+1],r[4]=e[h],r[5]=e[h+1],v.contains(x.x,x.y))return!0}return!1},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},r.BATCHABLE_SIZE=100,r}(f),_="varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n",b="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\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 = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n",D=function(t){function i(i,n){var o=this,a={uSampler:i,alpha:1,uTextureMatrix:u.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(n=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},n)).uniforms&&Object.assign(a,n.uniforms),(o=t.call(this,n.program||e.from(b,_),a)||this)._colorDirty=!1,o.uvMatrix=new r(i),o.batchable=void 0===n.program,o.pluginName=n.pluginName,o.tint=n.tint,o.alpha=n.alpha,o}return m(i,t),Object.defineProperty(i.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(t){this.uniforms.uSampler!==t&&(this.uniforms.uSampler=t,this.uvMatrix.texture=t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"alpha",{get:function(){return this._alpha},set:function(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"tint",{get:function(){return this._tint},set:function(t){t!==this._tint&&(this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),i.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;c(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},i}(i),I=function(t){function e(e,r,i){var o=t.call(this)||this,a=new n(e),s=new n(r,!0),u=new n(i,!0,!0);return o.addAttribute("aVertexPosition",a,2,!1,l.FLOAT).addAttribute("aTextureCoord",s,2,!1,l.FLOAT).addIndex(u),o._updateId=-1,o}return m(e,t),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(o);export{g as Mesh,y as MeshBatchUvs,I as MeshGeometry,D as MeshMaterial};
//# sourceMappingURL=mesh.min.js.map

@@ -49,3 +49,2 @@ /// <reference path="./global.d.ts" />

export declare class Mesh<T extends Shader = MeshMaterial> extends Container {
readonly geometry: Geometry;
shader: T;

@@ -56,2 +55,3 @@ state: State;

size: number;
private _geometry;
private vertexData;

@@ -75,2 +75,10 @@ private vertexDirty;

/**
* Includes vertex positions, face indices, normals, colors, UVs, and
* custom attributes within buffers, reducing the cost of passing all
* this data to the GPU. Can be shared between multiple Mesh objects.
* @member {PIXI.Geometry}
*/
get geometry(): Geometry;
set geometry(value: Geometry);
/**
* To change mesh uv's, change its uvBuffer data and increment its _updateID.

@@ -77,0 +85,0 @@ * @member {PIXI.Buffer}

{
"name": "@pixi/mesh",
"version": "6.1.3",
"version": "6.2.0",
"main": "dist/cjs/mesh.js",

@@ -28,10 +28,10 @@ "module": "dist/esm/mesh.js",

"peerDependencies": {
"@pixi/constants": "6.1.3",
"@pixi/core": "6.1.3",
"@pixi/display": "6.1.3",
"@pixi/math": "6.1.3",
"@pixi/settings": "6.1.3",
"@pixi/utils": "6.1.3"
"@pixi/constants": "6.2.0",
"@pixi/core": "6.2.0",
"@pixi/display": "6.2.0",
"@pixi/math": "6.2.0",
"@pixi/settings": "6.2.0",
"@pixi/utils": "6.2.0"
},
"gitHead": "2342b551124751206078602eb0e4408df230923e"
"gitHead": "793f21c0d0f2d2a423bd4339f40a569e1ea68711"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc