From 86a801c057fc3b0580d6130be5740c2ee503444f Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 27 Jan 2012 15:52:36 -0800 Subject: updated from old repo --- js/helper-classes/RDGE/GLMaterial.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'js/helper-classes/RDGE/GLMaterial.js') diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js index 51c27ace..c633f679 100644 --- a/js/helper-classes/RDGE/GLMaterial.js +++ b/js/helper-classes/RDGE/GLMaterial.js @@ -62,6 +62,10 @@ function GLMaterial( world ) this.getShader = function() { return this._shader; } this.getMaterialNode = function() { return this._materialNode; } + // a material can be animated or not. default is not. + // Any material needing continuous rendering should override this method + this.isAnimated = function() { return false; } + /////////////////////////////////////////////////////////////////////// // Common Material Methods @@ -174,6 +178,31 @@ function GLMaterial( world ) // animated materials should implement the update method } + this.registerTexture = function( texture ) + { + // the world needs to know about the texture map + var world = this.getWorld(); + if (!world) + console.log( "**** world not defined for registering texture map: " + texture.lookUpName ); + else + world.textureToLoad( texture ); + } + + this.loadTexture = function( texMapName, wrap, mips ) + { + var tex; + var world = this.getWorld(); + if (!world) + console.log( "world not defined for material with texture map" ); + else + { + var renderer = world.getRenderer(); + tex = renderer.getTextureByName(texMapName, wrap, mips ); + this.registerTexture( tex ); + } + return tex; + } + this.export = function() { // this function should be overridden by subclasses -- cgit v1.2.3