Sha256: d5085adfa9f1aa465a23b2abec6d6198ec21e1d146f47a9de8f420fe8c28122a

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

Jax.Material.Lighting = Jax.Class.create(Jax.Material, {
  initialize: function($super, options) {
    $super(Jax.Util.normalizeOptions(options, {shader: "lighting"}));
  },
  
  setUniforms: function($super, context, mesh, options, uniforms) {
    $super(context, mesh, options, uniforms);
    
    var light = context.world.lighting.getLight();
    uniforms.set({
      LIGHTING_ENABLED: context.world.lighting.isEnabled() && !(options.unlit),
      LIGHT_POSITION: light.getPosition(),
      LIGHT_DIRECTION: light.getDirection(),
      LIGHT_AMBIENT: light.getAmbientColor(),
      LIGHT_DIFFUSE: light.getDiffuseColor(),
      LIGHT_SPECULAR: light.getSpecularColor(),
      LIGHT_ATTENUATION_CONSTANT: light.getConstantAttenuation(),
      LIGHT_ATTENUATION_LINEAR: light.getLinearAttenuation(),
      LIGHT_ATTENUATION_QUADRATIC: light.getQuadraticAttenuation(),
      LIGHT_SPOT_EXPONENT: light.getSpotExponent(),
      LIGHT_SPOT_COS_CUTOFF: light.getSpotCosCutoff(),
      LIGHT_ENABLED: light.isEnabled(),
      LIGHT_TYPE: light.getType()
    });
  }
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jax-1.1.1 builtin/app/shaders/lighting/material.js
jax-1.1.0 builtin/app/shaders/lighting/material.js
jax-1.1.0.rc1 builtin/app/shaders/lighting/material.js
jax-1.0.1 builtin/shaders/lighting/material.js
jax-1.0.1.rc2 builtin/shaders/lighting/material.js
jax-1.0.1.rc1 builtin/shaders/lighting/material.js
jax-1.0.0 builtin/shaders/lighting/material.js