summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/models/vec3.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-06-04 00:31:01 -0400
committerJulie Lala <jules@okfoc.us>2014-06-04 00:31:01 -0400
commit80e1fcbc52870366f2e885fe82724960929765c9 (patch)
treed380e04e8d784c40606bdaad82dcd37d0e260de5 /assets/javascripts/rectangles/models/vec3.js
parent5fb0ad045820de96848e1bde8e2dba8a6853dd4d (diff)
parent90142bd07f926ef8a7f3ea86a563ec0ca648ca5d (diff)
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'assets/javascripts/rectangles/models/vec3.js')
-rw-r--r--assets/javascripts/rectangles/models/vec3.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/assets/javascripts/rectangles/models/vec3.js b/assets/javascripts/rectangles/models/vec3.js
deleted file mode 100644
index 4e00b0c..0000000
--- a/assets/javascripts/rectangles/models/vec3.js
+++ /dev/null
@@ -1,31 +0,0 @@
-function vec3(a,b,c){
- this.a = a
- this.b = b
- this.c = c
-}
-vec3.prototype.add = function(v){
- this.a += v.a
- this.b += v.b
- this.c += v.c
- return this
-}
-vec3.prototype.sub = function(v){
- this.a -= v.a
- this.b -= v.b
- this.c -= v.c
- return this
-}
-
-// input: mat4 projection matrix
-vec3.prototype.apply_projection = function (m) {
- var x = this.a, y = this.b, z = this.c;
-
- var e = m.elements;
- var d = 1 / ( e[3] * x + e[7] * y + e[11] * z + e[15] ); // perspective divide
-
- this.x = ( e[0] * x + e[4] * y + e[8] * z + e[12] ) * d;
- this.y = ( e[1] * x + e[5] * y + e[9] * z + e[13] ) * d;
- this.z = ( e[2] * x + e[6] * y + e[10] * z + e[14] ) * d;
-
- return this;
-}