Sha256: 4b12ef8884be7ff8ae519f57043cbed441d2263e3c72f60ea1df1a8bf35459da
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
describe("Preprocessor", function() { var context; var matr; beforeEach(function() { context = new Jax.Context(document.getElementById('canvas-element')); matr = new Jax.Material(); }); afterEach(function() { context.dispose(); }); it("should be able to determine shader type from within common code", function() { Jax.shaders['test'] = new Jax.Shader({ common: "void <%=shader_type%>(void) { return; }", vertex: "void main(void) { gl_Position = vec4(0,0,0,1); }", fragment: "void main(void) { discard; }", name: "test" }); expect(Jax.shaders['test'].getVertexSource(matr)).toMatch(/void vertex\(void\)/); expect(Jax.shaders['test'].getFragmentSource(matr)).toMatch(/void fragment\(void\)/); }); describe("with multiple similar vardecs", function() { Jax.shaders['test'] = new Jax.Shader({ vertex: "shared uniform mat4 ivMatrix, mvMatrix, pMatrix, vMatrix;\n" + "uniform mat4 imvMatrix;\n" + "void main(void) { gl_Position = pMatrix * imvMatrix * vec4(0,0,0,1); }", fragment: "void main(void) { }", name: "test" }); var TestMaterial = Jax.Class.create(Jax.Material, { initialize: function($super) { $super({shader: "test"}); }, setUniforms: function($super, context, mesh, options, uniforms) { $super(context, mesh, options, uniforms); uniforms.set('imvMatrix', context.getInverseModelViewMatrix()); } }); beforeEach(function() { matr.addLayer(new TestMaterial()); }); it("should should not fail", function() { new Jax.Mesh({material:matr}).render(context); }); }); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jax-0.0.0.9 | spec/javascripts/shaders/preprocessor_spec.js |
jax-0.0.0.8 | spec/javascripts/shaders/preprocessor_spec.js |