topical media & game development

talk show tell print

graphic-canvas-experiment-raytracer-script-basematerial.js / js



  /* Fake a Flog.* namespace */
  if(typeof(Flog) == 'undefined') var Flog = {};
  if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
  if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {};
  
  Flog.RayTracer.Material.BaseMaterial = Class.create();
  
  Flog.RayTracer.Material.BaseMaterial.prototype = {
  
      gloss: 2.0,             // [0...infinity] 0 = matt
      transparency: 0.0,      // 0=opaque
      reflection: 0.0,        // [0...infinity] 0 = no reflection
      refraction: 0.50,
      hasTexture: false,
  
      initialize : function() {
          
      },
      
      getColor: function(u, v){
          
      },
      
      wrapUp: function(t){
          t = t % 2.0;
          if(t < -1) t += 2.0;
          if(t >= 1) t -= 2.0;
          return t;
      },
      
      toString : function () {
          return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';    
      }
  }


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.