Sha256: 339abbff6618be7f0344bd44c42df6fd5b4c2b5e7e3f58362bc39838dc2f58cd

Contents?: true

Size: 1020 Bytes

Versions: 13

Compression:

Stored size: 1020 Bytes

Contents

Jax.LINEAR = 1;
Jax.EXPONENTIAL = 2;
Jax.EXP2 = 3;

Jax.Material.Fog = Jax.Class.create(Jax.Material, {
  initialize: function($super, options) {
    options = Jax.Util.normalizeOptions(options, {
      shader: "fog",
      algorithm: Jax.EXP2,
      start: 10.0,
      end: 100.0,
      density: 0.0015,
      color:[1,1,1,1]
    });
    options.color = Jax.Util.colorize(options.color);
    options.color = [options.color[0],options.color[1],options.color[2],options.color[3]];
    if (typeof(options.algorithm) == "string") {
      var name = options.algorithm;
      options.algorithm = Jax[name];
      if (!options.algorithm) throw new Error("Jax: Fog algorithm must be one of LINEAR, EXPONENTIAL, or EXP2");
    }
    $super(options);
  },
  
  setVariables: function(context, mesh, options, vars) {
    vars.set('End', this.end);
    vars.set('Scale', 1.0 / (this.end - this.start));
    vars.set('Algorithm', this.algorithm);
    vars.set('Density', this.density);
    vars.set('FogColor', this.color);
  }
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jax-2.0.12 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.11 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.10 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.9 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.8 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.7 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.6 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.5 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.4 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.3 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.2 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.1 lib/assets/javascripts/shaders/fog/material.js
jax-2.0.0 lib/assets/javascripts/shaders/fog/material.js