Merge remote-tracking branch 'origin/master' into 3d-tiles

This commit is contained in:
Patrick Cozzi 2016-03-08 14:57:59 -05:00
commit a116fcd5df
13 changed files with 127 additions and 53 deletions

View File

@ -1,15 +1,11 @@
language: node_js
node_js:
- '0.12'
- '4.3'
sudo: false
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- echo 'cloc' && echo -en 'travis_fold:start:script.cloc\\r'
- npm run cloc
- echo -en 'travis_fold:end:script.cloc\\r'
- echo 'jsHint' && echo -en 'travis_fold:start:script.jsHint\\r'
- npm run jsHint --failTaskOnError
- echo -en 'travis_fold:end:script.jsHint\\r'
@ -26,3 +22,7 @@ script:
- echo 'test non-webgl release' && echo -en 'travis_fold:start:script test.release\\r'
- npm run test -- --exclude WebGL --browsers Electron --failTaskOnError --release --suppressPassed
- echo -en 'travis_fold:end:script test.release\\r'
- echo 'cloc' && echo -en 'travis_fold:start:script.cloc\\r'
- npm run cloc
- echo -en 'travis_fold:end:script.cloc\\r'

View File

@ -21,6 +21,7 @@ TODO: this is not finished yet:
*
* Fixed `TimeIntervalCollection.removeInterval` bug that resulted in too many intervals being removed
* `GroundPrimitive` throws a `DeveloperError` when passed an unsupported geometry type instead of crashing.
* `GeoJsonDataSource` now handles CRS `urn:ogc:def:crs:EPSG::4326`
### 1.19 - 2016-03-01

View File

@ -88,3 +88,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Sanuj Sharma](https://github.com/sanuj)
* [Allen Korenevsky](https://github.com/theplatapi)
* [Samy Beaudoux](https://github.com/vrittis)
* [Mati Ostrovsky](https://github.com/mati-o)

View File

@ -81,6 +81,7 @@ Here's the full set of scripts and what they do.
* `minify` - Runs `combine`, plus [minifies](http://en.wikipedia.org/wiki/Minification_\(programming\)) Cesium.js using [UglifyJS2](https://github.com/mishoo/UglifyJS2) for a smaller deployable file.
* `combineRelease` - Runs `combine`, plus uses the optimizer to remove debugging code that validates function input and throws DeveloperErrors. The removed sections are marked with `//>>includeStart('debug', pragmas.debug);` blocks in the code.
* `minifyRelease` - Runs `minify`, and removes debugging code.
* `requirejs` - Used internally by the build system and can not be called directly.
* `buildApps` - Builds the example applications (such as Cesium Viewer) to produce self-contained, minified, deployable versions in the `Build` directory.
* `generateDocumentation` - Generates HTML documentation in `Build/Documentation` using [JSDoc 3](https://github.com/jsdoc3/jsdoc).
* `release` - A full release build that creates a shippable product, including building apps and generating documentation.

View File

@ -245,8 +245,8 @@ define([
var minX = Number.MAX_VALUE;
var minY = Number.MAX_VALUE;
var maxX = Number.MIN_VALUE;
var maxY = Number.MIN_VALUE;
var maxX = -Number.MAX_VALUE;
var maxY = -Number.MAX_VALUE;
for (var row = 0; row < height; ++row) {
for (var col = 0; col < width; ++col) {

View File

@ -61,7 +61,8 @@ define([
var crsNames = {
'urn:ogc:def:crs:OGC:1.3:CRS84' : defaultCrsFunction,
'EPSG:4326' : defaultCrsFunction
'EPSG:4326' : defaultCrsFunction,
'urn:ogc:def:crs:EPSG::4326' : defaultCrsFunction
};
var crsLinkHrefs = {};

View File

@ -60,7 +60,7 @@ define([
function createHeightFunction(camera, destination, startHeight, endHeight, optionAltitude) {
var altitude = optionAltitude;
var maxHeight;
var maxHeight = Math.max(startHeight, endHeight);
if (!defined(optionAltitude)) {
var start = camera.position;
@ -73,7 +73,6 @@ define([
var verticalDistance = Cartesian3.magnitude(Cartesian3.multiplyByScalar(up, Cartesian3.dot(diff, up), scratchCart2));
var horizontalDistance = Cartesian3.magnitude(Cartesian3.multiplyByScalar(right, Cartesian3.dot(diff, right), scratchCart2));
maxHeight = Math.max(startHeight, endHeight);
altitude = Math.min(getAltitude(frustum, verticalDistance, horizontalDistance) * 0.20, 1000000000.0);
}

View File

@ -1102,7 +1102,7 @@ define([
var nodeStack = [];
var min = new Cartesian3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
var max = new Cartesian3(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
var max = new Cartesian3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
for (var i = 0; i < rootNodesLength; ++i) {
var n = gltfNodes[rootNodes[i]];

View File

@ -1182,7 +1182,7 @@ define([
overlayList.length = 0;
var near = Number.MAX_VALUE;
var far = Number.MIN_VALUE;
var far = -Number.MAX_VALUE;
var undefBV = false;
var occluder = (frameState.mode === SceneMode.SCENE3D) ? frameState.occluder: undefined;

View File

@ -99,6 +99,28 @@ defineSuite([
}
};
var pointNamedCrsOgc = {
type : 'Point',
coordinates : [102.0, 0.5],
crs : {
type : 'name',
properties : {
name : 'urn:ogc:def:crs:OGC:1.3:CRS84'
}
}
};
var pointNamedCrsEpsg = {
type : 'Point',
coordinates : [102.0, 0.5],
crs : {
type : 'name',
properties : {
name : 'urn:ogc:def:crs:EPSG::4326'
}
}
};
var pointCrsLinkHref = {
type : 'Point',
coordinates : [102.0, 0.5],
@ -761,6 +783,24 @@ defineSuite([
});
});
it('Works with named crs OGC:1.3:CRS84', function() {
var dataSource = new GeoJsonDataSource();
return dataSource.load(pointNamedCrsOgc).then(function() {
var entityCollection = dataSource.entities;
var entity = entityCollection.values[0];
expect(entity.position.getValue(time)).toEqual(coordinatesToCartesian(point.coordinates));
});
});
it('Works with named crs EPSG::4326', function() {
var dataSource = new GeoJsonDataSource();
return dataSource.load(pointNamedCrsEpsg).then(function() {
var entityCollection = dataSource.entities;
var entity = entityCollection.values[0];
expect(entity.position.getValue(time)).toEqual(coordinatesToCartesian(point.coordinates));
});
});
it('Works with link crs href', function() {
var projectedPosition = new Cartesian3(1, 2, 3);
GeoJsonDataSource.crsLinkHrefs[pointCrsLinkHref.crs.properties.href] = function(properties) {

View File

@ -485,8 +485,8 @@ defineSuite([
it('boundingSphere returns the bounding sphere', function() {
var boundingSphere = texturedBoxModel.boundingSphere;
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, -0.25, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(0.75, CesiumMath.EPSILON3);
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, 0.0, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(0.866, CesiumMath.EPSILON3);
});
it('boundingSphere returns the bounding sphere when scale property is set', function() {
@ -494,8 +494,8 @@ defineSuite([
texturedBoxModel.scale = 10;
var boundingSphere = texturedBoxModel.boundingSphere;
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, -2.5, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(7.5, CesiumMath.EPSILON3);
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, 0.0, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(8.66, CesiumMath.EPSILON3);
texturedBoxModel.scale = originalScale;
});
@ -507,8 +507,8 @@ defineSuite([
texturedBoxModel.maximumScale = 10;
var boundingSphere = texturedBoxModel.boundingSphere;
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, -2.5, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(7.5, CesiumMath.EPSILON3);
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, 0.0, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(8.66, CesiumMath.EPSILON3);
texturedBoxModel.scale = originalScale;
texturedBoxModel.maximumScale = originalMaximumScale;
@ -519,8 +519,8 @@ defineSuite([
Matrix4.multiplyByScale(texturedBoxModel.modelMatrix, new Cartesian3(2, 5, 10), texturedBoxModel.modelMatrix);
var boundingSphere = texturedBoxModel.boundingSphere;
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, -1.25, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(7.5, CesiumMath.EPSILON3);
expect(boundingSphere.center).toEqualEpsilon(new Cartesian3(0.0, 0.0, 0.0), CesiumMath.EPSILON3);
expect(boundingSphere.radius).toEqualEpsilon(8.66, CesiumMath.EPSILON3);
texturedBoxModel.modelMatrix = originalMatrix;
});
@ -656,8 +656,9 @@ defineSuite([
minimumPixelSize : 1
}).then(function(m) {
var bs = m.boundingSphere;
expect(bs.center.equalsEpsilon(new Cartesian3(6378137.0, -0.25, 0.0), CesiumMath.EPSILON14));
expect(bs.radius).toEqualEpsilon(0.75, CesiumMath.EPSILON14);
expect(bs.center.equalsEpsilon(new Cartesian3(6378137.0, 0.0, 0.0), CesiumMath.EPSILON14));
var radius = Math.sqrt(0.5 * 0.5 * 3);
expect(bs.radius).toEqualEpsilon(radius, CesiumMath.EPSILON14);
expectRender(m);
primitives.remove(m);

View File

@ -35,8 +35,18 @@ var karmaConfigFile = path.join(__dirname, 'Specs/karma.conf.js');
//per-task variables. We use the command line argument here to detect which task is being run.
var taskName = process.argv[2];
var noDevelopmentGallery = taskName === 'release' || taskName === 'makeZipFile';
var buildingRelease = noDevelopmentGallery;
var minifyShaders = taskName === 'minify' || taskName === 'minifyRelease' || taskName === 'release' || taskName === 'makeZipFile' || taskName === 'buildApps';
//travis reports 32 cores but only has 3GB of memory, which causes the VM to run out. Limit to 8 cores instead.
var concurrency = Math.min(os.cpus().length, 8);
//Since combine and minify run in parallel already, split concurrency in half when building both.
//This can go away when gulp 4 comes out because it allows for synchronous tasks.
if (buildingRelease) {
concurrency = concurrency / 2;
}
var sourceFiles = ['Source/**/*.js',
'!Source/*.js',
'!Source/Workers/**',
@ -101,7 +111,7 @@ gulp.task('build-watch', function() {
gulp.watch(buildFiles, ['build']);
});
gulp.task('buildApps', ['combine', 'minifyRelease'], function() {
gulp.task('buildApps', function() {
return buildCesiumViewer();
});
@ -109,6 +119,13 @@ gulp.task('clean', function(done) {
async.forEach(filesToClean, rimraf, done);
});
gulp.task('requirejs', function(done) {
var config = JSON.parse(new Buffer(process.argv[3].substring(2), 'base64').toString('utf8'));
requirejs.optimize(config, function() {
done();
}, done);
});
gulp.task('cloc', ['build'], function() {
var cmdLine;
var clocPath = path.join('Tools', 'cloc-1.60', 'cloc-1.60.pl');
@ -495,7 +512,7 @@ gulp.task('sortRequires', function(done) {
});
function combineCesium(debug, optimizer, combineOutput) {
return requirejsOptimize({
return requirejsOptimize('Cesium.js', {
wrap : true,
useStrict : true,
optimize : optimizer,
@ -512,12 +529,13 @@ function combineCesium(debug, optimizer, combineOutput) {
}
function combineWorkers(debug, optimizer, combineOutput) {
return Promise.join(
globby(['Source/Workers/cesiumWorkerBootstrapper.js',
'Source/Workers/transferTypedArrayTest.js',
'Source/ThirdParty/Workers/*.js']).then(function(files) {
return Promise.all(files.map(function(file) {
return requirejsOptimize({
//This is done waterfall style for concurrency reasons.
return globby(['Source/Workers/cesiumWorkerBootstrapper.js',
'Source/Workers/transferTypedArrayTest.js',
'Source/ThirdParty/Workers/*.js'])
.then(function(files) {
return Promise.map(files, function(file) {
return requirejsOptimize(file, {
wrap : false,
useStrict : true,
optimize : optimizer,
@ -530,15 +548,18 @@ function combineWorkers(debug, optimizer, combineOutput) {
include : filePathToModuleId(path.relative('Source', file)),
out : path.join(combineOutput, path.relative('Source', file))
});
}));
}),
globby(['Source/Workers/*.js',
'!Source/Workers/cesiumWorkerBootstrapper.js',
'!Source/Workers/transferTypedArrayTest.js',
'!Source/Workers/createTaskProcessorWorker.js',
'!Source/ThirdParty/Workers/*.js']).then(function(files) {
return Promise.all(files.map(function(file) {
return requirejsOptimize({
}, {concurrency : concurrency});
})
.then(function() {
return globby(['Source/Workers/*.js',
'!Source/Workers/cesiumWorkerBootstrapper.js',
'!Source/Workers/transferTypedArrayTest.js',
'!Source/Workers/createTaskProcessorWorker.js',
'!Source/ThirdParty/Workers/*.js']);
})
.then(function(files) {
return Promise.map(files, function(file) {
return requirejsOptimize(file, {
wrap : true,
useStrict : true,
optimize : optimizer,
@ -550,15 +571,14 @@ function combineWorkers(debug, optimizer, combineOutput) {
include : filePathToModuleId(path.relative('Source', file)),
out : path.join(combineOutput, path.relative('Source', file))
});
}));
})
);
}, {concurrency : concurrency});
});
}
function minifyCSS(outputDirectory) {
return globby('Source/**/*.css').then(function(files) {
return Promise.all(files.map(function(file) {
return requirejsOptimize({
return Promise.map(files, function(file) {
return requirejsOptimize(file, {
wrap : true,
useStrict : true,
optimizeCss : 'standard',
@ -568,7 +588,7 @@ function minifyCSS(outputDirectory) {
cssIn : file,
out : path.join(outputDirectory, path.relative('Source', file))
});
}));
}, {concurrency : concurrency});
});
}
@ -830,7 +850,7 @@ function buildCesiumViewer() {
mkdirp.sync(cesiumViewerOutputDirectory);
var promise = Promise.join(
requirejsOptimize({
requirejsOptimize('CesiumViewer', {
wrap : true,
useStrict : true,
optimizeCss : 'standard',
@ -842,7 +862,7 @@ function buildCesiumViewer() {
name : 'CesiumViewerStartup',
out : cesiumViewerStartup
}),
requirejsOptimize({
requirejsOptimize('CesiumViewer CSS', {
wrap : true,
useStrict : true,
optimizeCss : 'standard',
@ -908,10 +928,19 @@ function removeExtension(p) {
return p.slice(0, -path.extname(p).length);
}
function requirejsOptimize(config) {
config.logLevel = 1;
function requirejsOptimize(name, config) {
console.log('Building ' + name);
return new Promise(function(resolve, reject) {
requirejs.optimize(config, resolve, reject);
var cmd = 'npm run requirejs -- --' + new Buffer(JSON.stringify(config)).toString('base64') + ' --silent';
child_process.exec(cmd, function(e) {
if (e) {
console.log('Error ' + name);
reject(e);
return;
}
console.log('Finished ' + name);
resolve();
});
});
}

View File

@ -33,9 +33,9 @@
"devDependencies": {
"almond": "0.3.1",
"async": "1.5.2",
"bluebird": "3.3.1",
"bluebird": "3.3.4",
"compression": "1.6.1",
"electron-prebuilt": "0.36.9",
"electron-prebuilt": "0.36.10",
"event-stream": "3.3.2",
"express": "4.13.4",
"globby": "4.0.0",
@ -63,7 +63,7 @@
"request": "2.69.0",
"rimraf": "2.5.2",
"strip-comments": "0.3.2",
"yargs": "3.32.0"
"yargs": "4.2.0"
},
"scripts": {
"start": "node server.js",
@ -74,6 +74,7 @@
"cloc": "gulp cloc",
"combine": "gulp combine",
"combineRelease": "gulp combineRelease",
"requirejs": "gulp requirejs",
"generateDocumentation": "gulp generateDocumentation",
"instrumentForCoverage": "gulp instrumentForCoverage",
"jsHint": "gulp jsHint",