diff options
Diffstat (limited to 'js/lib/rdge')
-rwxr-xr-x | js/lib/rdge/materials/uber-material.js | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js index d7bc2a87..a2c782d8 100755 --- a/js/lib/rdge/materials/uber-material.js +++ b/js/lib/rdge/materials/uber-material.js | |||
@@ -24,8 +24,8 @@ var UberMaterial = function UberMaterial() { | |||
24 | this._environmentAmount = 0.2; // 0 .. 1 | 24 | this._environmentAmount = 0.2; // 0 .. 1 |
25 | 25 | ||
26 | // set the default maps | 26 | // set the default maps |
27 | this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' }; | 27 | //this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' }; |
28 | //this._diffuseMapOb = { 'texture' : 'texture', 'wrap' : 'REPEAT' }; | 28 | this._diffuseMapOb = { 'texture' : 'texture', 'wrap' : 'REPEAT' }; |
29 | this._normalMapOb = { 'texture': 'assets/images/rocky-normal.jpg', 'wrap': 'REPEAT' }; | 29 | this._normalMapOb = { 'texture': 'assets/images/rocky-normal.jpg', 'wrap': 'REPEAT' }; |
30 | this._specularMapOb = { 'texture': 'assets/images/rocky-spec.jpg', 'wrap': 'REPEAT' }; | 30 | this._specularMapOb = { 'texture': 'assets/images/rocky-spec.jpg', 'wrap': 'REPEAT' }; |
31 | this._environmentMapOb = { 'texture': 'assets/images/silver.png', 'wrap': 'CLAMP', 'envReflection': this._environmentAmount }; | 31 | this._environmentMapOb = { 'texture': 'assets/images/silver.png', 'wrap': 'CLAMP', 'envReflection': this._environmentAmount }; |
@@ -255,34 +255,34 @@ var UberMaterial = function UberMaterial() { | |||
255 | } | 255 | } |
256 | }; | 256 | }; |
257 | 257 | ||
258 | this.updateDiffuseMap = function (value) { | 258 | this.updateDiffuseMap = function(value) { |
259 | var value = this._propValues["diffuseMap"]; | 259 | var value = this._propValues[ "diffuseMap" ]; |
260 | this._diffuseMapOb.texture = value; | 260 | this._diffuseMapOb.texture = value; |
261 | 261 | ||
262 | if ((value == null) || (value.length == 0)) { | 262 | if ((value == null) || (value.length == 0)) { |
263 | if (this._useDiffuseMap) { | 263 | if (this._useDiffuseMap) { |
264 | this._useDiffuseMap = false; | 264 | this._useDiffuseMap = false; |
265 | this._diffuseTexture = undefined; | 265 | this._diffuseTexture = undefined; |
266 | this.rebuildShader(); | 266 | this.rebuildShader(); |
267 | } | 267 | } |
268 | } else { | 268 | } else { |
269 | if (!this._useDiffuseMap) { | 269 | if (!this._useDiffuseMap) { |
270 | this._useDiffuseMap = true; | 270 | this._useDiffuseMap = true; |
271 | this.rebuildShader(); | 271 | this.rebuildShader(); |
272 | } else { | 272 | } else { |
273 | var material = this._materialNode; | 273 | var material = this._materialNode; |
274 | if (material) { | 274 | if (material) { |
275 | var technique = material.shaderProgram.defaultTechnique; | 275 | var technique = material.shaderProgram.defaultTechnique; |
276 | var renderer = RDGE.globals.engine.getContext().renderer; | 276 | var renderer = RDGE.globals.engine.getContext().renderer; |
277 | if (renderer && technique) { | 277 | if (renderer && technique) { |
278 | var tex = renderer.getTextureByName(value, caps.diffuseMap.wrap); | 278 | this._diffuseTexture = new Texture( this.getWorld(), value, caps.diffuseMap.wrap ); |
279 | this.registerTexture(tex); | 279 | var tex = this._diffuseTexture.getTexture(); |
280 | technique.s_diffuseMap.set(tex); | 280 | technique.s_diffuseMap.set( tex ); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | } | 283 | } |
284 | } | 284 | } |
285 | }; | 285 | }; |
286 | 286 | ||
287 | 287 | ||
288 | this.updateTextures = function() | 288 | this.updateTextures = function() |
@@ -404,7 +404,7 @@ var UberMaterial = function UberMaterial() { | |||
404 | if (material) | 404 | if (material) |
405 | { | 405 | { |
406 | var technique = material.shaderProgram.defaultTechnique; | 406 | var technique = material.shaderProgram.defaultTechnique; |
407 | var renderer = g_Engine.getContext().renderer; | 407 | var renderer = RDGE.globals.engine.getContext().renderer; |
408 | if (renderer && technique) | 408 | if (renderer && technique) |
409 | { | 409 | { |
410 | if (this._diffuseTexture && this._diffuseTexture.isAnimated()) | 410 | if (this._diffuseTexture && this._diffuseTexture.isAnimated()) |
@@ -738,9 +738,9 @@ var UberMaterial = function UberMaterial() { | |||
738 | 738 | ||
739 | var renderer = RDGE.globals.engine.getContext().renderer; | 739 | var renderer = RDGE.globals.engine.getContext().renderer; |
740 | if (this._useDiffuseMap) { | 740 | if (this._useDiffuseMap) { |
741 | var tex = renderer.getTextureByName(caps.diffuseMap.texture, caps.diffuseMap.wrap, caps.diffuseMap.mips); | 741 | this._diffuseTexture = new Texture( this.getWorld(), caps.diffuseMap.texture, caps.diffuseMap.wrap, caps.diffuseMap.mips ); |
742 | this.registerTexture(tex); | 742 | var tex = this._diffuseTexture.getTexture(); |
743 | technique.s_diffuseMap.set(tex); | 743 | technique.s_diffuseMap.set( tex ); |
744 | } | 744 | } |
745 | 745 | ||
746 | if (this._useNormalMap) { | 746 | if (this._useNormalMap) { |