Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #92 from OpenGeoscience/package-umd
Browse files Browse the repository at this point in the history
Package VGL as UMD and cut release 0.3.6
  • Loading branch information
jbeezley committed Feb 1, 2016
2 parents 6c03ff8 + a6801a1 commit a7bab82
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 15 deletions.
15 changes: 12 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,37 @@ module.exports = function (grunt) {
concat: {
dist: {
src: files,
dest: 'dist/vgl.js'
dest: 'dist/vgl.concat.js'
}
},
uglify: {
dist: {
files: {
'dist/vgl.min.js': files
'dist/vgl.min.js': 'dist/vgl.js'
},
options: {
mangle: true,
ASCIIOnly: true,
sourceMap: true
}
}
},
umd: {
dist: {
src: 'dist/vgl.concat.js',
dest: 'dist/vgl.js',
objectToExport: 'vgl',
amdModuleId: 'vgl'
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-umd');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('test', ['jshint', 'jscs']);
grunt.registerTask('default', ['concat', 'uglify']);
grunt.registerTask('default', ['concat', 'umd', 'uglify']);
};
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{
"name": "vgl",
"description": "VTK for the Web.",
"version": "0.3.5",
"version": "0.3.6",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "git://github.com/OpenGeoscience/vgl.git"
},
"dependencies": {},
"devDependencies": {
"grunt-contrib-jshint": "^0.11.3",
"grunt-jscs": "^2.2.0",
"jscs": "^2.4.0",
"jshint": "^2.8.0",
"grunt": "~0.4",
"grunt-cli": "^0.1.13",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-uglify": "^0.10.0"
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-uglify": "^0.10.0",
"grunt-jscs": "^2.2.0",
"grunt-umd": "^2.3.5",
"jscs": "^2.4.0",
"jshint": "^2.8.0"
},
"scripts": {
"mypublish": "grunt default test && cp dist/vgl* . && npm publish",
Expand Down
34 changes: 32 additions & 2 deletions vgl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define('vgl', [], function () {
return (root['vgl'] = factory());
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
root['vgl'] = factory();
}
}(this, function () {

//////////////////////////////////////////////////////////////////////////////
/**
* @module vgl
Expand Down Expand Up @@ -9015,7 +9031,7 @@ inherit(vgl.modelViewUniform, vgl.uniform);
* Create new instance of class modelViewOriginUniform.
*
* @param name
* @param uniform: a triplet of floats.
* @param {array} origin a triplet of floats.
* @returns {vgl.modelViewUniform}
*/
///////////////////////////////////////////////////////////////////////////////
Expand All @@ -9029,13 +9045,24 @@ vgl.modelViewOriginUniform = function (name, origin) {
if (name.length === 0) {
name = 'modelViewMatrix';
}
origin = origin || [0, 0, 0];

var m_origin = [origin[0], origin[1], origin[2] || 0];

vgl.uniform.call(this, vgl.GL.FLOAT_MAT4, name);

this.set(mat4.create());

/**
* Change the origin used by the uniform view matrix.
*
* @param {array} origin a triplet of floats.
*/
this.setOrigin = function (origin) {
origin = origin || [0, 0, 0];
m_origin = [origin[0], origin[1], origin[2] || 0];
};

/////////////////////////////////////////////////////////////////////////////
/**
* Update the uniform given a render state and shader program. This offsets
Expand Down Expand Up @@ -9138,7 +9165,6 @@ vgl.floatUniform = function (name, value) {

inherit(vgl.floatUniform, vgl.uniform);


///////////////////////////////////////////////////////////////////////////////
/**
* Create new instance of class normalMatrixUniform
Expand Down Expand Up @@ -12520,3 +12546,7 @@ vgl.DataBuffers = function (initialSize) {
return data[name].array;
};
};

return vgl;

}));
8 changes: 4 additions & 4 deletions vgl.min.js

Large diffs are not rendered by default.

0 comments on commit a7bab82

Please sign in to comment.