ol.vec.Mat4 improvements

* Rename ol.vec.Mat4.fromMatrix to ol.vec.Mat4.fromTransform
* Make result from ol.vec.Mat4.fromTransform immutable by adding result
  matrix as argument.
This commit is contained in:
Andreas Hocevar
2016-06-23 15:52:25 +02:00
parent 6b4ee42c90
commit 3e928718f4
4 changed files with 41 additions and 17 deletions

View File

@@ -145,6 +145,12 @@ ol.render.webgl.ImageReplay = function(tolerance, maxExtent) {
*/
this.projectionMatrix_ = ol.transform.create();
/**
* @type {Array.<number>}
* @private
*/
this.tmpMat4_ = ol.vec.Mat4.create();
/**
* @private
* @type {boolean|undefined}
@@ -565,9 +571,12 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
ol.transform.rotate(offsetRotateMatrix, -rotation);
}
gl.uniformMatrix4fv(locations.u_projectionMatrix, false, ol.vec.Mat4.fromMatrix(projectionMatrix));
gl.uniformMatrix4fv(locations.u_offsetScaleMatrix, false, ol.vec.Mat4.fromMatrix(offsetScaleMatrix));
gl.uniformMatrix4fv(locations.u_offsetRotateMatrix, false, ol.vec.Mat4.fromMatrix(offsetRotateMatrix));
gl.uniformMatrix4fv(locations.u_projectionMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, projectionMatrix));
gl.uniformMatrix4fv(locations.u_offsetScaleMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetScaleMatrix));
gl.uniformMatrix4fv(locations.u_offsetRotateMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetRotateMatrix));
gl.uniform1f(locations.u_opacity, opacity);
// draw!