Sha256: f791379cdbd3a064f7d8861957dc2d3c07438b74c9f8ae5c8a200991be52508f

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

describe("Material segment 'paraboloid'", function() {
  var matr;
  
  beforeEach(function() {
    matr = new Jax.Material.Paraboloid();
    spyOn(matr, 'prepareShader').andCallThrough();
  });
  
  it("should compile successfully", function() {
    new Jax.Mesh({material:matr}).render(SPEC_CONTEXT);
    expect(matr.prepareShader).toHaveBeenCalled();
  });

  it("should be rendered in both directions", function() {
    var front = false, back = false;
    var mesh = new Jax.Mesh.Quad({material:matr});
    
    var old_render = mesh.render;

    mesh.render = function(context, options) {
      if (options && options.direction && options.direction ==  1) front = true;
      if (options && options.direction && options.direction == -1) back = true;
      old_render.apply(this, arguments);
    };
    
    SPEC_CONTEXT.world.addObject(new Jax.Model({mesh: mesh}));
    SPEC_CONTEXT.world.addLightSource(new Jax.Scene.LightSource({type:Jax.POINT_LIGHT}));
    SPEC_CONTEXT.world.render();
    
    expect(front).toBeTrue();
    expect(back).toBeTrue();
  });
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jax-2.0.12 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.11 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.10 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.9 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.8 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.7 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.6 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.5 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.4 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.3 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.2 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.1 spec/javascripts/shaders/paraboloid_spec.js
jax-2.0.0 spec/javascripts/shaders/paraboloid_spec.js