aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLMaterial.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-09 12:09:09 -0800
committerJose Antonio Marquez2012-02-09 12:09:09 -0800
commit44c65bc6bbd5b754f9073f93a3afca8dd9acc864 (patch)
tree0e9ac4c8b2f8ce3246739ab06053e9986e8c9b51 /js/helper-classes/RDGE/GLMaterial.js
parentd7e198f5a95011679fa2c536780edbdc533a4893 (diff)
parentce81a3f4387d80f9ac406e73b843fb5dbe9cf432 (diff)
downloadninja-44c65bc6bbd5b754f9073f93a3afca8dd9acc864.tar.gz
Merge branch 'refs/heads/NinjaInternal' into FileIO
Diffstat (limited to 'js/helper-classes/RDGE/GLMaterial.js')
-rwxr-xr-xjs/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 51c27ace..c633f679 100755
--- 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