aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLMaterial.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-09 12:02:27 -0800
committerNivesh Rajbhandari2012-02-09 12:02:27 -0800
commita9b1a1f2642841c4165ede69d131b1deb6238622 (patch)
tree2076dc497fbde041283af8b0082b0f4e24c9e1c6 /js/helper-classes/RDGE/GLMaterial.js
parent31e2eb0d0da9b032116ad073918ca36ec11dac45 (diff)
parentce81a3f4387d80f9ac406e73b843fb5dbe9cf432 (diff)
downloadninja-a9b1a1f2642841c4165ede69d131b1deb6238622.tar.gz
Merge branch 'refs/heads/ninja-internal' into SnapManagerFixes
Conflicts: js/helper-classes/RDGE/Materials/FlatMaterial.js Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/GLMaterial.js')
-rw-r--r--js/helper-classes/RDGE/GLMaterial.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js
index e1a68abd..e72b7908 100644
--- a/js/helper-classes/RDGE/GLMaterial.js
+++ b/js/helper-classes/RDGE/GLMaterial.js
@@ -62,6 +62,10 @@ function GLMaterial( world )
62 this.getShader = function() { return this._shader; } 62 this.getShader = function() { return this._shader; }
63 this.getMaterialNode = function() { return this._materialNode; } 63 this.getMaterialNode = function() { return this._materialNode; }
64 64
65 // a material can be animated or not. default is not.
66 // Any material needing continuous rendering should override this method
67 this.isAnimated = function() { return false; }
68
65 69
66 /////////////////////////////////////////////////////////////////////// 70 ///////////////////////////////////////////////////////////////////////
67 // Common Material Methods 71 // Common Material Methods
@@ -174,6 +178,31 @@ function GLMaterial( world )
174 // animated materials should implement the update method 178 // animated materials should implement the update method
175 } 179 }
176 180
181 this.registerTexture = function( texture )
182 {
183 // the world needs to know about the texture map
184 var world = this.getWorld();
185 if (!world)
186 console.log( "**** world not defined for registering texture map: " + texture.lookUpName );
187 else
188 world.textureToLoad( texture );
189 }
190
191 this.loadTexture = function( texMapName, wrap, mips )
192 {
193 var tex;
194 var world = this.getWorld();
195 if (!world)
196 console.log( "world not defined for material with texture map" );
197 else
198 {
199 var renderer = world.getRenderer();
200 tex = renderer.getTextureByName(texMapName, wrap, mips );
201 this.registerTexture( tex );
202 }
203 return tex;
204 }
205
177 this.export = function() 206 this.export = function()
178 { 207 {
179 // this function should be overridden by subclasses 208 // this function should be overridden by subclasses