Sha256: 80a4ecd8f2ea4c8eb957d93a05b324640b02530ca4d502ff6cea64c16815e7a3

Contents?: true

Size: 1.35 KB

Versions: 13

Compression:

Stored size: 1.35 KB

Contents

describe("Jax.MatrixStack", function() {
  var stack;
  
  beforeEach(function() { stack = new Jax.MatrixStack(); });
  
  it('should return a model matrix', function() { expect(stack.getModelMatrix()).not.toBeUndefined(); });
  it('should return a view matrix', function() { expect(stack.getViewMatrix()).not.toBeUndefined(); });
  it('should return a proj matrix', function() { expect(stack.getProjectionMatrix()).not.toBeUndefined(); });
      
  describe("with a pushed matrix", function() {
    beforeEach(function() { stack.push(); });
    
    it('should return a model matrix', function() { expect(stack.getModelMatrix()).not.toBeUndefined(); });
    it('should return a view matrix', function() { expect(stack.getViewMatrix()).not.toBeUndefined(); });
    it('should return a proj matrix', function() { expect(stack.getProjectionMatrix()).not.toBeUndefined(); });
      
    describe("translate", function() {
      beforeEach(function() { stack.loadViewMatrix(mat4.translate(mat4.IDENTITY, [1,1,1], mat4.create())); });
      
      it("should not be an identity matrix", function() { expect(stack.getViewMatrix()).not.toEqualMatrix(mat4.IDENTITY); });
      
      it("should produce coords relative to eye", function() {
        var vec = mat4.multiplyVec3(stack.getInverseViewMatrix(), [0,0,0]);
        expect(vec).toEqualVector([-1,-1,-1]);
      });
    });
  });
});

Version data entries

13 entries across 13 versions & 1 rubygems

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