Created
January 20, 2015 15:43
-
-
Save GoodBoyDigital/03e8b3d949cc591d1adc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FilterManager.prototype.calculateMagixMatrix = function (filterArea, wt) | |
{ | |
var m = new math.Matrix(); | |
// scale.. | |
var ratio = this.textureSize.height / this.textureSize.width; | |
m.translate(filterArea.x / (this.textureSize.width), filterArea.y / this.textureSize.height); | |
m.scale(1 , ratio); | |
var transform = wt.clone(); | |
var translateScaleX = (this.textureSize.width / 620); | |
var translateScaleY = (this.textureSize.height / 380); | |
transform.tx /= 620 * translateScaleX; | |
transform.ty /= 620 * translateScaleX; | |
transform.invert(); | |
transform.append(m); | |
// apply inverse scale.. | |
transform.scale(1 , 1/ratio); | |
transform.scale( translateScaleX , translateScaleY ); | |
return transform; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment