From 025f5097ef5537984f7e3072a785eb8e635c9ae9 Mon Sep 17 00:00:00 2001 From: strikerM Date: Mon, 11 Apr 2016 11:17:50 +0300 Subject: [PATCH] Added the possibility to translate a ColladaScene. --- src/formats/collada/ColladaScene.js | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/formats/collada/ColladaScene.js b/src/formats/collada/ColladaScene.js index 90ac48116..9a4c27f81 100644 --- a/src/formats/collada/ColladaScene.js +++ b/src/formats/collada/ColladaScene.js @@ -63,6 +63,11 @@ define([ this._yRotation = 0; this._zRotation = 0; + // Documented in defineProperties below. + this._xTranslation = 0; + this._yTranslation = 0; + this._zTranslation = 0; + // Documented in defineProperties below. this._scale = 1; @@ -241,6 +246,48 @@ define([ } }, + /** + * The scene's translation for the x axis. + * @memberof ColladaScene.prototype + * @type {Number} + */ + xTranslation: { + get: function () { + return this._xTranslation; + }, + set: function (value) { + this._xTranslation = value; + } + }, + + /** + * The scene's translation for the y axis. + * @memberof ColladaScene.prototype + * @type {Number} + */ + yTranslation: { + get: function () { + return this._yTranslation; + }, + set: function (value) { + this._yTranslation = value; + } + }, + + /** + * The scene's translation for the z axis. + * @memberof ColladaScene.prototype + * @type {Number} + */ + zTranslation: { + get: function () { + return this._zTranslation; + }, + set: function (value) { + this._zTranslation = value; + } + }, + /** * The scene's scale. * @memberof ColladaScene.prototype @@ -792,6 +839,8 @@ define([ this.transformationMatrix.multiplyByScale(this.scale, this.scale, this.scale); + this.transformationMatrix.multiplyByTranslation(this.xTranslation, this.yTranslation, this.zTranslation); + this.computeNormalMatrix(); };