Sha256: c32a1fbb3e7a8d540befa9b5e1fd909603437ed4688ec04adefbdcd17cc33e56

Contents?: true

Size: 1022 Bytes

Versions: 10

Compression:

Stored size: 1022 Bytes

Contents

Jax.Material.Lighting = Jax.Class.create(Jax.Material, {
  initialize: function($super) {
    $super({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

10 entries across 10 versions & 1 rubygems

Version Path
jax-0.0.0.10 builtin/shaders/lighting/material.js
jax-0.0.0.9 builtin/shaders/lighting/material.js
jax-0.0.0.8 builtin/shaders/lighting/material.js
jax-0.0.0.7 builtin/shaders/lighting/material.js
jax-0.0.0.6 builtin/shaders/lighting/material.js
jax-0.0.0.5 builtin/shaders/lighting/material.js
jax-0.0.0.4 builtin/shaders/lighting/material.js
jax-0.0.0.3 builtin/shaders/lighting/material.js
jax-0.0.0.2 builtin/shaders/lighting/material.js
jax-0.0.0.1 builtin/shaders/lighting/material.js