@pixi/filter-displacement
Advanced tools
Comparing version 7.2.4 to 7.3.0-rc
@@ -1,14 +0,11 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@pixi/core'); | ||
var displacement$1 = require('./displacement.js'); | ||
var displacement = require('./displacement2.js'); | ||
"use strict"; | ||
var core = require("@pixi/core"), displacement$1 = require("./displacement.frag.js"), displacement = require("./displacement.vert.js"); | ||
class DisplacementFilter extends core.Filter { | ||
/** | ||
* @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) | ||
* @param scale - The scale of the displacement | ||
*/ | ||
constructor(sprite, scale) { | ||
const maskMatrix = new core.Matrix(); | ||
sprite.renderable = false; | ||
super(displacement["default"], displacement$1["default"], { | ||
sprite.renderable = !1, super(displacement.default, displacement$1.default, { | ||
mapSampler: sprite._texture, | ||
@@ -18,25 +15,17 @@ filterMatrix: maskMatrix, | ||
rotation: new Float32Array([1, 0, 0, 1]) | ||
}); | ||
this.maskSprite = sprite; | ||
this.maskMatrix = maskMatrix; | ||
if (scale === null || scale === void 0) { | ||
scale = 20; | ||
} | ||
this.scale = new core.Point(scale, scale); | ||
}), this.maskSprite = sprite, this.maskMatrix = maskMatrix, scale == null && (scale = 20), this.scale = new core.Point(scale, scale); | ||
} | ||
/** | ||
* Applies the filter. | ||
* @param filterManager - The manager. | ||
* @param input - The input target. | ||
* @param output - The output target. | ||
* @param clearMode - clearMode. | ||
*/ | ||
apply(filterManager, input, output, clearMode) { | ||
this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); | ||
this.uniforms.scale.x = this.scale.x; | ||
this.uniforms.scale.y = this.scale.y; | ||
const wt = this.maskSprite.worldTransform; | ||
const lenX = Math.sqrt(wt.a * wt.a + wt.b * wt.b); | ||
const lenY = Math.sqrt(wt.c * wt.c + wt.d * wt.d); | ||
if (lenX !== 0 && lenY !== 0) { | ||
this.uniforms.rotation[0] = wt.a / lenX; | ||
this.uniforms.rotation[1] = wt.b / lenX; | ||
this.uniforms.rotation[2] = wt.c / lenY; | ||
this.uniforms.rotation[3] = wt.d / lenY; | ||
} | ||
filterManager.applyFilter(this, input, output, clearMode); | ||
this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite), this.uniforms.scale.x = this.scale.x, this.uniforms.scale.y = this.scale.y; | ||
const wt = this.maskSprite.worldTransform, lenX = Math.sqrt(wt.a * wt.a + wt.b * wt.b), lenY = Math.sqrt(wt.c * wt.c + wt.d * wt.d); | ||
lenX !== 0 && lenY !== 0 && (this.uniforms.rotation[0] = wt.a / lenX, this.uniforms.rotation[1] = wt.b / lenX, this.uniforms.rotation[2] = wt.c / lenY, this.uniforms.rotation[3] = wt.d / lenY), filterManager.applyFilter(this, input, output, clearMode); | ||
} | ||
/** The texture used for the displacement map. Must be power of 2 sized texture. */ | ||
get map() { | ||
@@ -49,4 +38,3 @@ return this.uniforms.mapSampler; | ||
} | ||
exports.DisplacementFilter = DisplacementFilter; | ||
//# sourceMappingURL=DisplacementFilter.js.map |
@@ -1,10 +0,4 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var DisplacementFilter = require('./DisplacementFilter.js'); | ||
"use strict"; | ||
var DisplacementFilter = require("./DisplacementFilter.js"); | ||
exports.DisplacementFilter = DisplacementFilter.DisplacementFilter; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@pixi/filter-displacement", | ||
"version": "7.2.4", | ||
"version": "7.3.0-rc", | ||
"main": "lib/index.js", | ||
@@ -39,4 +39,4 @@ "module": "lib/index.mjs", | ||
"peerDependencies": { | ||
"@pixi/core": "7.2.4" | ||
"@pixi/core": "7.3.0-rc" | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
221
21453
1