aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src/core')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js2
-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/run_state.js16
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js4
9 files changed, 39 insertions, 23 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
index 43813078..7dfc79d4 100755
--- a/js/helper-classes/RDGE/src/core/script/MeshManager.js
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -69,7 +69,7 @@ MeshManager.prototype.deleteMesh = function (name)
69 if (model) 69 if (model)
70 { 70 {
71 g_Engine.ctxMan.forEach(function(context) 71 g_Engine.ctxMan.forEach(function(context)
72 { 72 {
73 context.renderer.deletePrimitive(model.primitive); 73 context.renderer.deletePrimitive(model.primitive);
74 }); 74 });
75 75
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/run_state.js b/js/helper-classes/RDGE/src/core/script/run_state.js
index acdb6797..a5981caa 100755
--- a/js/helper-classes/RDGE/src/core/script/run_state.js
+++ b/js/helper-classes/RDGE/src/core/script/run_state.js
@@ -30,9 +30,9 @@ RunState.prototype.Init = function()
30 this.userRunState.init(); 30 this.userRunState.init();
31 } 31 }
32 32
33 if (this.hasUserState && this.userRunState && this.userRunState.onRunState) 33 if (this.hasUserState && this.userRunState && this.userRunState.onRunState)
34 this.userRunState.onRunState(); 34 this.userRunState.onRunState();
35 35
36 36
37 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38 38
@@ -97,11 +97,11 @@ RunState.prototype.ReInit = function()
97 if(!this.initialized) 97 if(!this.initialized)
98 { 98 {
99 this.Init(); 99 this.Init();
100 } 100 }
101 else 101 else
102 { 102 {
103 if (this.hasUserState && this.userRunState && this.userRunState.onRunState) 103 if (this.hasUserState && this.userRunState && this.userRunState.onRunState)
104 this.userRunState.onRunState(); 104 this.userRunState.onRunState();
105 } 105 }
106} 106}
107 107
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 {