aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-14 15:17:01 -0700
committerJose Antonio Marquez2012-03-14 15:17:01 -0700
commite7e18f02870a0cfe06e550acf8ffef6eab945231 (patch)
treec940a63fd47e60f121c42b1823194522c8c2820f /js/helper-classes/RDGE/src/core/script
parentef601b13a2529c207eb782942e918212e5a0805e (diff)
parent089534a80c64226bf7d124ab9147afce386fdb5c (diff)
downloadninja-e7e18f02870a0cfe06e550acf8ffef6eab945231.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js15
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/ssao.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js8
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js1
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js4
7 files changed, 30 insertions, 14 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js
index 5bc9305c..f5724665 100755
--- a/js/helper-classes/RDGE/src/core/script/engine.js
+++ b/js/helper-classes/RDGE/src/core/script/engine.js
@@ -89,6 +89,8 @@ stateManager = function()
89g_enableBenchmarks = true; 89g_enableBenchmarks = true;
90function Engine() 90function Engine()
91{ 91{
92 this._assetPath = "assets/";
93
92 // map of scene graphs to names 94 // map of scene graphs to names
93 this.sceneMap = []; 95 this.sceneMap = [];
94 96
@@ -228,6 +230,19 @@ function Engine()
228 contextManager.currentCtx = savedCtx; 230 contextManager.currentCtx = savedCtx;
229 231
230 } 232 }
233
234 this.remapAssetFolder = function( url )
235 {
236 var searchStr = "assets/";
237 var index = url.indexOf( searchStr );
238 var rtnPath = url;
239 if (index >= 0)
240 {
241 rtnPath = url.substr( index + searchStr.length );
242 rtnPath = this._assetPath + rtnPath;
243 }
244 return rtnPath;
245 }
231 246
232} 247}
233 248
diff --git a/js/helper-classes/RDGE/src/core/script/fx/ssao.js b/js/helper-classes/RDGE/src/core/script/fx/ssao.js
index 05793594..9761b02d 100755
--- a/js/helper-classes/RDGE/src/core/script/fx/ssao.js
+++ b/js/helper-classes/RDGE/src/core/script/fx/ssao.js
@@ -32,7 +32,7 @@ function fxSSAO(enHRDepth)
32 } 32 }
33 33
34 // Load random normal texture 34 // Load random normal texture
35 this.randTexture = createTexture(gl, "assets/images/random_normal.png"); 35 this.randTexture = createTexture(gl, g_Engine._assetPath+"images/random_normal.png");
36 gl.bindTexture(gl.TEXTURE_2D, this.randTexture); 36 gl.bindTexture(gl.TEXTURE_2D, this.randTexture);
37 gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR); 37 gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);
38 gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.REPEAT); 38 gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.REPEAT);
diff --git a/js/helper-classes/RDGE/src/core/script/init_state.js b/js/helper-classes/RDGE/src/core/script/init_state.js
index 4b97a4f4..5ffbbd13 100755
--- a/js/helper-classes/RDGE/src/core/script/init_state.js
+++ b/js/helper-classes/RDGE/src/core/script/init_state.js
@@ -42,16 +42,16 @@ LoadState.prototype.Init = function()
42 if(this.sceneName) 42 if(this.sceneName)
43 { 43 {
44 this.loadScene("assets_web/mesh/" + this.sceneName + ".json", this.sceneName); 44 this.loadScene("assets_web/mesh/" + this.sceneName + ".json", this.sceneName);
45 } 45 }
46 46
47 if (this.hasUserState && this.userRunState && this.userRunState.onLoadState) 47 if (this.hasUserState && this.userRunState && this.userRunState.onLoadState)
48 this.userRunState.onLoadState(); 48 this.userRunState.onLoadState();
49} 49}
50 50
51LoadState.prototype.ReInit = function() 51LoadState.prototype.ReInit = function()
52{ 52{
53 if (this.hasUserState && this.userRunState && this.userRunState.onLoadState) 53 if (this.hasUserState && this.userRunState && this.userRunState.onLoadState)
54 this.userRunState.onLoadState(); 54 this.userRunState.onLoadState();
55} 55}
56 56
57LoadState.prototype.Resize = function() 57LoadState.prototype.Resize = function()
diff --git a/js/helper-classes/RDGE/src/core/script/jshader.js b/js/helper-classes/RDGE/src/core/script/jshader.js
index 36c5939e..ceb67536 100755
--- a/js/helper-classes/RDGE/src/core/script/jshader.js
+++ b/js/helper-classes/RDGE/src/core/script/jshader.js
@@ -191,8 +191,8 @@ jshader = function(addr) {
191 case "mat2": this.data = [0, 0, 0, 0]; break; 191 case "mat2": this.data = [0, 0, 0, 0]; break;
192 case "float": this.data = [0]; break; 192 case "float": this.data = [0]; break;
193 case "int": this.data = [0]; break; 193 case "int": this.data = [0]; break;
194 case "tex2d": this.data = [ctx.canvas.renderer.getTextureByName("assets/images/white.png")]; break; 194 case "tex2d": this.data = [ctx.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")]; break;
195 case "texCube": this.data = [ctx.canvas.renderer.getTextureByName("assets/images/white.png")]; break; 195 case "texCube": this.data = [ctx.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")]; break;
196 } 196 }
197 } 197 }
198 else { 198 else {
@@ -243,8 +243,8 @@ jshader = function(addr) {
243 case "mat2": this.data = [0, 0, 0, 0]; break; 243 case "mat2": this.data = [0, 0, 0, 0]; break;
244 case "float": this.data = [0]; break; 244 case "float": this.data = [0]; break;
245 case "int": this.data = [0]; break; 245 case "int": this.data = [0]; break;
246 case "tex2d": this.data = [ctx.canvas.renderer.getTextureByName("assets/images/white.png")]; break; 246 case "tex2d": this.data = [ctx.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")]; break;
247 case "texCube": this.data = [ctx.canvas.renderer.getTextureByName("assets/images/white.png")]; break; 247 case "texCube": this.data = [ctx.canvas.renderer.getTextureByName(g_Engine._assetPath+"images/white.png")]; break;
248 } 248 }
249 } 249 }
250 else { 250 else {
diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js
index a50b8a68..c01068a4 100755
--- a/js/helper-classes/RDGE/src/core/script/renderer.js
+++ b/js/helper-classes/RDGE/src/core/script/renderer.js
@@ -338,6 +338,7 @@ _renderer = function(canvas) {
338 if (tex === undefined) 338 if (tex === undefined)
339 { 339 {
340 // load the texture 340 // load the texture
341 name = g_Engine.remapAssetFolder( name );
341 tex = this.createTexture(name + ext, wrap, mips); 342 tex = this.createTexture(name + ext, wrap, mips);
342 this.textureMap[name] = tex; 343 this.textureMap[name] = tex;
343 tex.lookUpName = name; 344 tex.lookUpName = name;
diff --git a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
index e80a14fb..93ee12bf 100755
--- a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
+++ b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
@@ -336,7 +336,7 @@ materialNodeTemplate = function(matNode)
336 matNode.setTexture = function(texType, texName) 336 matNode.setTexture = function(texType, texName)
337 { 337 {
338 var renderer = g_Engine.getContext().renderer; 338 var renderer = g_Engine.getContext().renderer;
339 this.textureList[texType].handle = renderer.getTextureByName("assets/images/" + texName); 339 this.textureList[texType].handle = renderer.getTextureByName(g_Engine._assetPath+"/images/" + texName);
340 this.textureList[texType].unit = texType; 340 this.textureList[texType].unit = texType;
341 this.textureList[texType].type = UNIFORMTYPE.TEXTURE2D; 341 this.textureList[texType].type = UNIFORMTYPE.TEXTURE2D;
342 342
diff --git a/js/helper-classes/RDGE/src/core/script/utilities.js b/js/helper-classes/RDGE/src/core/script/utilities.js
index e19c727f..e55f2b33 100755
--- a/js/helper-classes/RDGE/src/core/script/utilities.js
+++ b/js/helper-classes/RDGE/src/core/script/utilities.js
@@ -159,7 +159,7 @@ function createShader(ctx, strVertShaderName, strFragShaderName, attribs)
159 } else 159 } else
160 { 160 {
161 var vshaderRequest = new XMLHttpRequest(); 161 var vshaderRequest = new XMLHttpRequest();
162 vshaderRequest.open("GET", 'assets/shaders/' + strVertShaderName + '.glsl', false); 162 vshaderRequest.open("GET", g_Engine._assetPath+'shaders/' + strVertShaderName + '.glsl', false);
163 vshaderRequest.send(null); 163 vshaderRequest.send(null);
164 vShader = vshaderRequest.responseText; 164 vShader = vshaderRequest.responseText;
165 } 165 }
@@ -169,7 +169,7 @@ function createShader(ctx, strVertShaderName, strFragShaderName, attribs)
169 } else 169 } else
170 { 170 {
171 var fshaderRequest = new XMLHttpRequest(); 171 var fshaderRequest = new XMLHttpRequest();
172 fshaderRequest.open("GET", 'assets/shaders/' + strFragShaderName + '.glsl', false); 172 fshaderRequest.open("GET", g_Engine._assetPath+'shaders/' + strFragShaderName + '.glsl', false);
173 fshaderRequest.send(null); 173 fshaderRequest.send(null);
174 fShader = fshaderRequest.responseText; 174 fShader = fshaderRequest.responseText;
175 } 175 }