From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Fri, 6 Jul 2012 11:52:06 -0700
Subject: Expand tabs
---
js/helper-classes/RDGE/src/core/script/utilities.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'js/helper-classes/RDGE/src/core/script/utilities.js')
diff --git a/js/helper-classes/RDGE/src/core/script/utilities.js b/js/helper-classes/RDGE/src/core/script/utilities.js
index 7dfe5e44..ff67868c 100755
--- a/js/helper-classes/RDGE/src/core/script/utilities.js
+++ b/js/helper-classes/RDGE/src/core/script/utilities.js
@@ -68,7 +68,7 @@ RDGE.unProject = function (winx, winy, winz, modelMatrix, projMatrix, viewport)
var v4Out = RDGE.mat4.transformPoint(finalMatrix, inVal);
if (v4Out[3] <= 0.0001)
- return null;
+ return null;
v4Out[0] /= v4Out[3];
v4Out[1] /= v4Out[3];
@@ -181,19 +181,19 @@ RDGE.createShader = function (ctx, strVertShaderName, strFragShaderName, attribs
if (strVertShaderName.indexOf('{') != -1) {
vShader = strVertShaderName;
} else {
- var vshaderRequest = new XMLHttpRequest();
- vshaderRequest.open("GET", RDGE.globals.engine._assetPath+'shaders/' + strVertShaderName + '.glsl', false);
- vshaderRequest.send(null);
- vShader = vshaderRequest.responseText;
+ var vshaderRequest = new XMLHttpRequest();
+ vshaderRequest.open("GET", RDGE.globals.engine._assetPath+'shaders/' + strVertShaderName + '.glsl', false);
+ vshaderRequest.send(null);
+ vShader = vshaderRequest.responseText;
}
if (strFragShaderName.indexOf('{') != -1) {
fShader = strFragShaderName;
} else {
- var fshaderRequest = new XMLHttpRequest();
+ var fshaderRequest = new XMLHttpRequest();
fshaderRequest.open("GET", RDGE.globals.engine._assetPath+'shaders/' + strFragShaderName + '.glsl', false);
fshaderRequest.send(null);
- fShader = fshaderRequest.responseText;
+ fShader = fshaderRequest.responseText;
}
ctx.useProgram(null);
--
cgit v1.2.3
From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Fri, 6 Jul 2012 11:53:10 -0700
Subject: Remove trailing spaces
---
.../RDGE/src/core/script/utilities.js | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
(limited to 'js/helper-classes/RDGE/src/core/script/utilities.js')
diff --git a/js/helper-classes/RDGE/src/core/script/utilities.js b/js/helper-classes/RDGE/src/core/script/utilities.js
index ff67868c..3cf43e92 100755
--- a/js/helper-classes/RDGE/src/core/script/utilities.js
+++ b/js/helper-classes/RDGE/src/core/script/utilities.js
@@ -32,13 +32,13 @@ POSSIBILITY OF SUCH DAMAGE.
var RDGE = RDGE || {};
-/*
+/*
// Methods not currently used in Ninja
RDGE.getRandColor = function () {
var r = Math.random();
var g = Math.random();
var b =Math.random();
-
+
return [r, g, b, 1.0];
};
@@ -46,7 +46,7 @@ RDGE.unProject = function (winx, winy, winz, modelMatrix, projMatrix, viewport)
var inVal = [0,0,0,0];
var finalMatrix = RDGE.mat4.mul(modelMatrix, projMatrix);
-
+
finalMatrix = RDGE.mat4.inverse(finalMatrix);
if(!finalMatrix)
return null;
@@ -56,24 +56,24 @@ RDGE.unProject = function (winx, winy, winz, modelMatrix, projMatrix, viewport)
inVal[2]=winz;
inVal[3]=1.0;
- // Map x and y from window coordinates
+ // Map x and y from window coordinates
inVal[0] = (inVal[0] - viewport[0]) / viewport[2];
inVal[1] = (inVal[1] - viewport[1]) / viewport[3];
- // Map to range -1 to 1
+ // Map to range -1 to 1
inVal[0] = inVal[0] * 2 - 1;
inVal[1] = inVal[1] * 2 - 1;
inVal[2] = inVal[2] * 2 - 1;
var v4Out = RDGE.mat4.transformPoint(finalMatrix, inVal);
-
- if (v4Out[3] <= 0.0001)
+
+ if (v4Out[3] <= 0.0001)
return null;
-
+
v4Out[0] /= v4Out[3];
v4Out[1] /= v4Out[3];
v4Out[2] /= v4Out[3];
-
+
return [ v4Out[0], v4Out[1], v4Out[2] ];
};
@@ -87,7 +87,7 @@ RDGE.AABB2LineSegment = function (box, startPoint, endPoint) {
var adx = Math.abs(d[0]);
if( Math.abs(m[0]) > e[0] + adx ) return false;
-
+
var ady = Math.abs(d[1]);
if( Math.abs(m[1]) > e[1] + ady ) return false;
@@ -109,7 +109,7 @@ RDGE.hitTest = function (mesh, near, far) {
// holds distance to the nearest BV
var dist = null;
var BV = null;
-
+
for (var index = 0; index < mesh.BVL.length; index++) {
if (AABB2LineSegment(mesh.BVL[index], near, far)) {
var center = RDGE.vec3.scale(RDGE.vec3.add(mesh.BVL[index].min, mesh.BVL[index].max), 0.5);
@@ -147,7 +147,7 @@ RDGE.loadShader = function (ctx, shaderType, shaderStr) {
var shader = ctx.createShader(shaderType);
if (shader == null) {
- ctx.console.log("*** Error: unable to create shader '"+shaderType+"'");
+ ctx.console.log("*** Error: unable to create shader '"+shaderType+"'");
return null;
}
@@ -236,7 +236,7 @@ RDGE.createShader = function (ctx, strVertShaderName, strFragShaderName, attribs
return null;
}
-
+
program.shaderID = "Shader" + RDGE.g_shaderCounter++;
program.vname = strVertShaderName;
program.RDGEUniform = new RDGE.RDGEUniformInit();
--
cgit v1.2.3
From 3644cb6def4f681c99959e5729e78ea353441fad Mon Sep 17 00:00:00 2001
From: Kris Kowal
Date: Fri, 6 Jul 2012 12:34:53 -0700
Subject: Normalize to unix line terminators
---
.../RDGE/src/core/script/utilities.js | 530 ++++++++++-----------
1 file changed, 265 insertions(+), 265 deletions(-)
(limited to 'js/helper-classes/RDGE/src/core/script/utilities.js')
diff --git a/js/helper-classes/RDGE/src/core/script/utilities.js b/js/helper-classes/RDGE/src/core/script/utilities.js
index 3cf43e92..157fa5e2 100755
--- a/js/helper-classes/RDGE/src/core/script/utilities.js
+++ b/js/helper-classes/RDGE/src/core/script/utilities.js
@@ -1,265 +1,265 @@
-/*
-Copyright (c) 2012, Motorola Mobility, Inc
-All Rights Reserved.
-BSD License.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- - Neither the name of Motorola Mobility nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
- */
-
-// RDGE namespaces
-var RDGE = RDGE || {};
-
-
-/*
-// Methods not currently used in Ninja
-RDGE.getRandColor = function () {
- var r = Math.random();
- var g = Math.random();
- var b =Math.random();
-
- return [r, g, b, 1.0];
-};
-
-RDGE.unProject = function (winx, winy, winz, modelMatrix, projMatrix, viewport) {
- var inVal = [0,0,0,0];
-
- var finalMatrix = RDGE.mat4.mul(modelMatrix, projMatrix);
-
- finalMatrix = RDGE.mat4.inverse(finalMatrix);
- if(!finalMatrix)
- return null;
-
- inVal[0]=winx;
- inVal[1]=winy;
- inVal[2]=winz;
- inVal[3]=1.0;
-
- // Map x and y from window coordinates
- inVal[0] = (inVal[0] - viewport[0]) / viewport[2];
- inVal[1] = (inVal[1] - viewport[1]) / viewport[3];
-
- // Map to range -1 to 1
- inVal[0] = inVal[0] * 2 - 1;
- inVal[1] = inVal[1] * 2 - 1;
- inVal[2] = inVal[2] * 2 - 1;
-
- var v4Out = RDGE.mat4.transformPoint(finalMatrix, inVal);
-
- if (v4Out[3] <= 0.0001)
- return null;
-
- v4Out[0] /= v4Out[3];
- v4Out[1] /= v4Out[3];
- v4Out[2] /= v4Out[3];
-
- return [ v4Out[0], v4Out[1], v4Out[2] ];
-};
-
-RDGE.AABB2LineSegment = function (box, startPoint, endPoint) {
- c = RDGE.vec3.scale(RDGE.vec3.add(box.min, box.max), 0.5);
- e = RDGE.vec3.sub(box.max, box.min);
- d = RDGE.vec3.sub(endPoint, startPoint);
- m = RDGE.vec3.sub(startPoint, endPoint);
- m = RDGE.vec3.sub(m, box.min),
- m = RDGE.vec3.sub(m, box.max);
-
- var adx = Math.abs(d[0]);
- if( Math.abs(m[0]) > e[0] + adx ) return false;
-
- var ady = Math.abs(d[1]);
- if( Math.abs(m[1]) > e[1] + ady ) return false;
-
- var adz = Math.abs(d[2]);
- if( Math.abs(m[2]) > e[2] + adz ) return false;
-
- adx += 1.192092896e-07;
- ady += 1.192092896e-07;
- adz += 1.192092896e-07;
-
- if( Math.abs(m[1] * d[2] - m[2] * d[1]) > e[1] * adz + e[2] * ady ) return false;
- if( Math.abs(m[2] * d[0] - m[0] * d[2]) > e[0] * adz + e[2] * adx ) return false;
- if( Math.abs(m[0] * d[1] - m[1] * d[0]) > e[0] * ady + e[1] * adx ) return false;
-
- return true;
-};
-
-RDGE.hitTest = function (mesh, near, far) {
- // holds distance to the nearest BV
- var dist = null;
- var BV = null;
-
- for (var index = 0; index < mesh.BVL.length; index++) {
- if (AABB2LineSegment(mesh.BVL[index], near, far)) {
- var center = RDGE.vec3.scale(RDGE.vec3.add(mesh.BVL[index].min, mesh.BVL[index].max), 0.5);
- var newDist = RDGE.vec3.dot(RDGE.mat4.row(RDGE.globals.cam.world, 2), center);
- if (newDist < dist || dist == null) {
- dist = newDist;
- BV = mesh.BVL[index];
- }
- }
- }
- return BV;
-};
-
-
-
-*/
-
-
-
-
-
-
-
-
-// loadShader
-// 'shaderId' is the id of a