aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLMaterial.js
diff options
context:
space:
mode:
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