aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/math/vec4.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 14:57:31 -0700
committerJohn Mayhew2012-04-02 14:57:31 -0700
commitfb0a659c9ca3479fd6799325498b11f074689936 (patch)
tree46342298281aa93e48756e040715f42770ccc526 /js/helper-classes/RDGE/src/core/script/math/vec4.js
parentc24f58c10231c30d3a8a4c9fb9a4f395dd746180 (diff)
downloadninja-fb0a659c9ca3479fd6799325498b11f074689936.tar.gz
-Namespaced all RDGE javascript.
-Removed the following unused files from the build script /core/script/fx/blur.js /core/script/fx/ssao.js /core/script/animation.js - Fully removed the following from the build and from source control as they are unused or no longer needed /core/script/util/dbgpanel.js /core/script/util/fpsTracker.js /core/script/util/statTracker.js /core/script/input.js /core/script/TextureManager.js /core/script/ubershader.js
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/math/vec4.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec4.js315
1 files changed, 158 insertions, 157 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/math/vec4.js b/js/helper-classes/RDGE/src/core/script/math/vec4.js
index 3a0de375..a655d006 100755
--- a/js/helper-classes/RDGE/src/core/script/math/vec4.js
+++ b/js/helper-classes/RDGE/src/core/script/math/vec4.js
@@ -5,254 +5,255 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7/** 7/**
8* vec4 = {} 8* RDGE.vec4 = {}
9* This library contains functions for operating on 4D vectors. Any JS array 9* This library contains functions for operating on 4D vectors. Any JS array
10* containing at least 4 numeric components can represent a 4D vector. 10* containing at least 4 numeric components can represent a 4D vector.
11* 11*
12* For example, all of these are valid vec4 declarations: 12* For example, all of these are valid RDGE.vec4 declarations:
13* var a = [0, 0, 0, 1]; 13* var a = [0, 0, 0, 1];
14* var b = vec3.identity(); 14* var b = RDGE.RDGE.vec4.identity();
15* var c = vec3.zero(); 15* var c = RDGE.RDGE.vec4.zero();
16* 16*
17*/ 17*/
18vec4 = {}; 18var RDGE = RDGE || {};
19RDGE.vec4 = {};
19 20
20/** 21/**
21* vec4.string 22* RDGE.vec4.string
22*/ 23*/
23vec4.string = function(v) { 24RDGE.vec4.string = function (v) {
24 return "{ " + v[0] + ", " + v[1] + ", " + v[2] + ", " + v[3] + " }"; 25 return "{ " + v[0] + ", " + v[1] + ", " + v[2] + ", " + v[3] + " }";
25} 26};
26 27
27/** 28/**
28* vec4.verify 29* RDGE.vec4.verify
29*/ 30*/
30vec4.verify = function(v) { 31RDGE.vec4.verify = function (v) {
31 if (v == undefined || v.length == undefined || v.length < 4) { 32 if (v == undefined || v.length == undefined || v.length < 4) {
32 return false; 33 return false;
33 } 34 }
34 35
35 if (typeof (v[0]) != "number" || typeof (v[1]) != "number" || typeof (v[2]) != "number" || typeof (v[3]) != "number") { 36 if (typeof (v[0]) != "number" || typeof (v[1]) != "number" || typeof (v[2]) != "number" || typeof (v[3]) != "number") {
36 return false; 37 return false;
37 } 38 }
38 39
39 return true; 40 return true;
40} 41};
41 42
42/** 43/**
43* vec4.inplace_copy 44* RDGE.vec4.inplace_copy
44*/ 45*/
45vec4.inplace_copy = function(dst, src) { 46RDGE.vec4.inplace_copy = function (dst, src) {
46 dst[0] = src[0]; 47 dst[0] = src[0];
47 dst[1] = src[1]; 48 dst[1] = src[1];
48 dst[2] = src[2]; 49 dst[2] = src[2];
49 dst[3] = src[3]; 50 dst[3] = src[3];
50} 51};
51 52
52/** 53/**
53* vec4.copy 54* RDGE.vec4.copy
54*/ 55*/
55vec4.copy = function(v) { 56RDGE.vec4.copy = function (v) {
56 if( v.length == undefined ) { 57 if (v.length == undefined) {
57 return [ v, v, v, v ]; 58 return [v, v, v, v];
58 } 59 }
59 60
60 if( v.length == 3 ) { 61 if (v.length == 3) {
61 return [ v[0], v[1], v[2], 1.0 ]; 62 return [v[0], v[1], v[2], 1.0];
62 } 63 }
63 64
64 return [ v[0], v[1], v[2], v[3] ]; 65 return [v[0], v[1], v[2], v[3]];
65} 66};
66 67
67/** 68/**
68* vec4.zero 69* RDGE.vec4.zero
69*/ 70*/
70vec4.zero = function() { 71RDGE.vec4.zero = function () {
71 return [ 0.0, 0.0, 0.0, 0.0 ]; 72 return [0.0, 0.0, 0.0, 0.0];
72} 73};
73 74
74/** 75/**
75* vec4.identity 76* RDGE.vec4.identity
76*/ 77*/
77vec4.identity = function() { 78RDGE.vec4.identity = function () {
78 return [ 0.0, 0.0, 0.0, 1.0 ]; 79 return [0.0, 0.0, 0.0, 1.0];
79} 80};
80 81
81/** 82/**
82* vec4.up 83* RDGE.vec4.up
83*/ 84*/
84vec4.up = function() { 85RDGE.vec4.up = function () {
85 return [ 0.0, 1.0, 0.0, 0.0 ]; 86 return [0.0, 1.0, 0.0, 0.0];
86} 87};
87 88
88/** 89/**
89* vec4.forward 90* RDGE.vec4.forward
90*/ 91*/
91vec4.forward = function() { 92RDGE.vec4.forward = function () {
92 return [ 0.0, 0.0, 1.0, 0.0 ]; 93 return [0.0, 0.0, 1.0, 0.0];
93} 94};
94 95
95/** 96/**
96* vec4.right 97* RDGE.vec4.right
97*/ 98*/
98vec4.right = function() { 99RDGE.vec4.right = function () {
99 return [ 1.0, 0.0, 0.0, 0.0 ]; 100 return [1.0, 0.0, 0.0, 0.0];
100} 101};
101 102
102/** 103/**
103* vec4.random 104* RDGE.vec4.random
104*/ 105*/
105vec4.random = function(min, max) { 106RDGE.vec4.random = function (min, max) {
106 return [ min[0] + (max[0] - min[0]) * Math.random(), 107 return [min[0] + (max[0] - min[0]) * Math.random(),
107 min[1] + (max[1] - min[1]) * Math.random(), 108 min[1] + (max[1] - min[1]) * Math.random(),
108 min[2] + (max[2] - min[2]) * Math.random(), 109 min[2] + (max[2] - min[2]) * Math.random(),
109 min[3] + (max[3] - min[3]) * Math.random()]; 110 min[3] + (max[3] - min[3]) * Math.random()];
110} 111};
111 112
112/** 113/**
113* vec4.add 114* RDGE.vec4.add
114*/ 115*/
115vec4.add = function(a, b) { 116RDGE.vec4.add = function (a, b) {
116 return [ a[0] + b[0], 117 return [a[0] + b[0],
117 a[1] + b[1], 118 a[1] + b[1],
118 a[2] + b[2], 119 a[2] + b[2],
119 a[3] + b[3] ]; 120 a[3] + b[3]];
120} 121};
121 122
122/** 123/**
123* vec4.sub 124* RDGE.vec4.sub
124*/ 125*/
125vec4.sub = function(a, b) { 126RDGE.vec4.sub = function (a, b) {
126 return [ a[0] - b[0], 127 return [a[0] - b[0],
127 a[1] - b[1], 128 a[1] - b[1],
128 a[2] - b[2], 129 a[2] - b[2],
129 a[3] - b[3] ]; 130 a[3] - b[3]];
130} 131};
131 132
132/** 133/**
133* vec4.mul 134* RDGE.vec4.mul
134*/ 135*/
135vec4.mul = function(a, b) { 136RDGE.vec4.mul = function (a, b) {
136 return [ a[0] * b[0], 137 return [a[0] * b[0],
137 a[1] * b[1],