Sha256: 7f1c089ace3fe286bf0d22b527a8013774da3e8638b833478d38f5d09d910b05

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

describe("Material segment 'texture'", function() {
  var context;
  var matr;
  
  beforeEach(function() {
    context = new Jax.Context(document.getElementById('canvas-element'));
    matr = new Jax.Material();
    spyOn(matr, 'prepareShader').andCallThrough();
  });
  
  afterEach(function() { context.dispose(); });
  
  it("should not replace options if image is POT", function() {
    matr = new Jax.Material({"ambient":{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0},
      "diffuse":{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0},
      "specular":{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0},
      "shininess":30,
      "layers":[
        {"type":"Lighting"},
        {"type":"Texture","path":"/images/rock.png","flip_y":false,"scale_x":1.0,"scale_y":1.0,"generate_mipmap":true,"min_filter":"GL_NEAREST","mag_filter":"GL_NEAREST","mipmap_hint":"GL_DONT_CARE","format":"GL_RGBA","data_type":"GL_UNSIGNED_BYTE","wrap_s":"GL_REPEAT","wrap_t":"GL_REPEAT","premultiply_alpha":false,"colorspace_conversion":true},
        {"type":"NormalMap","path":"/images/rockNormal.png","flip_y":false,"scale_x":1.0,"scale_y":1.0,"generate_mipmap":true,"min_filter":"GL_NEAREST","mag_filter":"GL_NEAREST","mipmap_hint":"GL_DONT_CARE","format":"GL_RGBA","data_type":"GL_UNSIGNED_BYTE","wrap_s":"GL_REPEAT","wrap_t":"GL_REPEAT","premultiply_alpha":false,"colorspace_conversion":true}
      ]
    });
    
    waitsFor(function() {
      if (matr.layers[1].texture.loaded) {
        expect(Jax.Util.enumName(matr.layers[1].texture.options.wrap_s)).toEqual("GL_REPEAT");
        return true;
      }
      return false;
    });
  });
  
  it("should compile successfully", function() {
    matr.addLayer(new Jax.Material.Texture(new Jax.Texture("/images/rss.png")));
    
    new Jax.Mesh({material:matr}).render(context);
    expect(matr.prepareShader).toHaveBeenCalled();
  });
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jax-0.0.0.9 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.8 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.7 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.6 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.5 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.4 spec/javascripts/shaders/texture_spec.js
jax-0.0.0.3 spec/javascripts/jax/builtin/materials/texture_spec.js