Skip to content

Commit c3b7110

Browse files
committed
projective inverse
1 parent b794402 commit c3b7110

File tree

7 files changed

+31
-1627
lines changed

7 files changed

+31
-1627
lines changed

build/MathBox-bundle.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46973,7 +46973,8 @@ MathBox.ViewportProjective = function (options) {
4697346973

4697446974
// Prepare uniforms
4697546975
_.extend(this._uniforms, {
46976-
projectiveTransform: new THREE.Matrix4(),//,
46976+
projectiveTransform: new THREE.Matrix4(),
46977+
projectiveInverse: new THREE.Matrix4(),
4697746978
});
4697846979
};
4697946980

@@ -47004,13 +47005,18 @@ MathBox.ViewportProjective.prototype = _.extend(new MathBox.ViewportCartesian(nu
4700447005
from: function (vector) {
4700547006
// Apply inverse viewport
4700647007
this.inverse.multiplyVector3(vector);
47008+
47009+
// Apply inverse projective transform
47010+
this._uniforms.projectiveInverse.multiplyVector3(vector);
4700747011
},
4700847012

4700947013
update: function (stage) {
4701047014
var t = this._uniforms.projectiveTransform;
4701147015
var m = this.get('projective');
4701247016
t.set.apply(t, m[0].concat(m[1], m[2], m[3]));
4701347017

47018+
this._uniforms.projectiveInverse.getInverse(t);
47019+
4701447020
MathBox.ViewportCartesian.prototype.update.call(this, stage);
4701547021
},
4701647022

build/MathBox-bundle.min.js

Lines changed: 1 addition & 1303 deletions
Large diffs are not rendered by default.

build/MathBox-core.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4364,7 +4364,8 @@ MathBox.ViewportProjective = function (options) {
43644364

43654365
// Prepare uniforms
43664366
_.extend(this._uniforms, {
4367-
projectiveTransform: new THREE.Matrix4(),//,
4367+
projectiveTransform: new THREE.Matrix4(),
4368+
projectiveInverse: new THREE.Matrix4(),
43684369
});
43694370
};
43704371

@@ -4395,13 +4396,18 @@ MathBox.ViewportProjective.prototype = _.extend(new MathBox.ViewportCartesian(nu
43954396
from: function (vector) {
43964397
// Apply inverse viewport
43974398
this.inverse.multiplyVector3(vector);
4399+
4400+
// Apply inverse projective transform
4401+
this._uniforms.projectiveInverse.multiplyVector3(vector);
43984402
},
43994403

44004404
update: function (stage) {
44014405
var t = this._uniforms.projectiveTransform;
44024406
var m = this.get('projective');
44034407
t.set.apply(t, m[0].concat(m[1], m[2], m[3]));
44044408

4409+
this._uniforms.projectiveInverse.getInverse(t);
4410+
44054411
MathBox.ViewportCartesian.prototype.update.call(this, stage);
44064412
},
44074413

build/MathBox-core.min.js

Lines changed: 1 addition & 120 deletions
Large diffs are not rendered by default.

build/MathBox.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7350,7 +7350,8 @@ MathBox.ViewportProjective = function (options) {
73507350

73517351
// Prepare uniforms
73527352
_.extend(this._uniforms, {
7353-
projectiveTransform: new THREE.Matrix4(),//,
7353+
projectiveTransform: new THREE.Matrix4(),
7354+
projectiveInverse: new THREE.Matrix4(),
73547355
});
73557356
};
73567357

@@ -7381,13 +7382,18 @@ MathBox.ViewportProjective.prototype = _.extend(new MathBox.ViewportCartesian(nu
73817382
from: function (vector) {
73827383
// Apply inverse viewport
73837384
this.inverse.multiplyVector3(vector);
7385+
7386+
// Apply inverse projective transform
7387+
this._uniforms.projectiveInverse.multiplyVector3(vector);
73847388
},
73857389

73867390
update: function (stage) {
73877391
var t = this._uniforms.projectiveTransform;
73887392
var m = this.get('projective');
73897393
t.set.apply(t, m[0].concat(m[1], m[2], m[3]));
73907394

7395+
this._uniforms.projectiveInverse.getInverse(t);
7396+
73917397
MathBox.ViewportCartesian.prototype.update.call(this, stage);
73927398
},
73937399

build/MathBox.min.js

Lines changed: 1 addition & 200 deletions
Large diffs are not rendered by default.

src/viewports/ViewportProjective.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ MathBox.ViewportProjective = function (options) {
88

99
// Prepare uniforms
1010
_.extend(this._uniforms, {
11-
projectiveTransform: new THREE.Matrix4(),//,
11+
projectiveTransform: new THREE.Matrix4(),
12+
projectiveInverse: new THREE.Matrix4(),
1213
});
1314
};
1415

@@ -39,13 +40,18 @@ MathBox.ViewportProjective.prototype = _.extend(new MathBox.ViewportCartesian(nu
3940
from: function (vector) {
4041
// Apply inverse viewport
4142
this.inverse.multiplyVector3(vector);
43+
44+
// Apply inverse projective transform
45+
this._uniforms.projectiveInverse.multiplyVector3(vector);
4246
},
4347

4448
update: function (stage) {
4549
var t = this._uniforms.projectiveTransform;
4650
var m = this.get('projective');
4751
t.set.apply(t, m[0].concat(m[1], m[2], m[3]));
4852

53+
this._uniforms.projectiveInverse.getInverse(t);
54+
4955
MathBox.ViewportCartesian.prototype.update.call(this, stage);
5056
},
5157

0 commit comments

Comments
 (0)