topical media & game development

talk show tell print

mobile-query-three-plugins-fog-tquery.world.createfog.js / js



  
@fileOverview Methods to add/remove fog in tQuery.World - removeFog isnt done as some wiki pages claim it is impossible github.com/mrdoob/three.js/wiki/Updates

  
  
  
add a THREE.FogExp2 to this world.scene()
parameter: opts the options
parameter: opts.colorHex the hexa value of the fog color
parameter: opts.density the density of the fog

  
  tQuery.World.registerInstance('addFogExp2', function(opts){
          // handle parameter
          opts        = tQuery.extend(opts, {
                  colorHex        : this.tRenderer().getClearColor().getHex(),
                  density                : 0.1
          });
          // set the fog
          this.tScene().fog        = new THREE.FogExp2(opts.colorHex, opts.density );
          // for chained API
          return this;
  });
  
  
add a THREE.Fog to this world.scene()
parameter: opts the options
parameter: opts.colorHex the hexa value of the fog color
parameter: opts.near how far away from camera, the fog starts
parameter: opts.far how far away from camera, the fog ends

  
  tQuery.World.registerInstance('addFog', function(opts){
          // handle parameter
          opts        = tQuery.extend(opts, {
                  colorHex        : this.tRenderer().getClearColor().getHex(),
                  near                : 1,
                  far                : 20
          });
          // set the fog
          this.tScene().fog        = new THREE.Fog(opts.colorHex, opts.near, opts.far);
          // for chained API
          return this;
  });
  
  


(C) Æliens 04/09/2009

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.