diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000000..2536d66bf13a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/Apps/Sandcastle/CesiumSandcastle.js b/Apps/Sandcastle/CesiumSandcastle.js index 585947073935..92fdba14ffdd 100644 --- a/Apps/Sandcastle/CesiumSandcastle.js +++ b/Apps/Sandcastle/CesiumSandcastle.js @@ -1,5 +1,6 @@ /*global require,Blob,JSHINT*/ /*global gallery_demos*/// defined by gallery/gallery-index.js, created by build +/*global hello_world_index*/// defined in gallery/gallery-index.js, created by build /*global sandcastleJsHintOptions*/// defined by jsHintOptions.js, created by build require({ baseUrl : '../../Source', @@ -138,6 +139,7 @@ require({ var subtabs = {}; var docError = false; var galleryError = false; + var notFound = false; var galleryTooltipTimer; var activeGalleryTooltipDemo; var demoTileHeightRule = findCssStyle('.demoTileThumbnail'); @@ -305,7 +307,7 @@ require({ var selectedTabName = registry.byId('innerPanel').selectedChildWidget.title; var suffix = selectedTabName + 'Demos'; if (selectedTabName === 'All') { - suffix = ''; + suffix = 'all'; } else if (selectedTabName === 'Search Results') { suffix = 'searchDemo'; } @@ -693,6 +695,7 @@ require({ } function loadFromGallery(demo) { + notFound = false; document.getElementById('saveAsFile').download = demo.name + '.html'; registry.byId('description').set('value', decodeHTML(demo.description).replace(/\\n/g, '\n')); registry.byId('label').set('value', decodeHTML(demo.label).replace(/\\n/g, '\n')); @@ -803,6 +806,9 @@ require({ if (galleryError) { appendConsole('consoleError', 'Error loading gallery, please run the build script.', true); } + if (notFound) { + appendConsole('consoleLog', 'Unable to load demo named ' + queryObject.src.replace('.html', '') + '\n', true); + } } } else if (Cesium.defined(e.data.log)) { // Console log messages from the iframe display in Sandcastle. @@ -1054,8 +1060,15 @@ require({ url : 'gallery/' + name + '.html', handleAs : 'text', error : function(error) { - appendConsole('consoleError', error, true); - galleryError = true; + if (error.status === 404) { + loadFromGallery(gallery_demos[hello_world_index]) + .then(function() { + notFound = true; + }); + } else { + galleryError = true; + appendConsole('consoleError', error, true); + } } }); } diff --git a/Apps/Sandcastle/gallery/3D Models Coloring.html b/Apps/Sandcastle/gallery/3D Models Coloring.html new file mode 100644 index 000000000000..979c9a6f955a --- /dev/null +++ b/Apps/Sandcastle/gallery/3D Models Coloring.html @@ -0,0 +1,242 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Model Color
Mode
Color
Alpha + + +
Mix + + +
Model Silhouette
Color
Alpha + + +
Size + + +
+
+ + + diff --git a/Apps/Sandcastle/gallery/3D Models Coloring.jpg b/Apps/Sandcastle/gallery/3D Models Coloring.jpg new file mode 100644 index 000000000000..dff69552e5ca Binary files /dev/null and b/Apps/Sandcastle/gallery/3D Models Coloring.jpg differ diff --git a/Apps/Sandcastle/gallery/3D Models.html b/Apps/Sandcastle/gallery/3D Models.html index 30caabdb7188..faa2af95ed0a 100644 --- a/Apps/Sandcastle/gallery/3D Models.html +++ b/Apps/Sandcastle/gallery/3D Models.html @@ -94,4 +94,4 @@ } - + \ No newline at end of file diff --git a/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html new file mode 100644 index 000000000000..592c3f1f3615 --- /dev/null +++ b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.html @@ -0,0 +1,301 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.jpg b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.jpg new file mode 100644 index 000000000000..22d9d9be59b9 Binary files /dev/null and b/Apps/Sandcastle/gallery/3D Tiles Batch Table Hierarchy.jpg differ diff --git a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html index e3cad457044b..bd9fffb83d0f 100644 --- a/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html +++ b/Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html @@ -150,18 +150,22 @@ }); addStyle('Min and Max', { - color : "rgb(min(${POSITION}[0], 0.75) * 255, max(${POSITION}[2], 0.25) * 255, 255)", + color : "rgb(min(${POSITION}.x, 0.75) * 255, max(${POSITION}.z, 0.25) * 255, 255)", pointSize : "5" }); +addStyle('Clamp and Mix', { + color : "color() * clamp(${temperature}, 0.1, 0.2)", + pointSize : "mix(${temperature}, 2.0, 0.5) * 0.2" +}); + addStyle('Secondary Color', { color : { - expression : "[${secondaryColor}[0], ${secondaryColor}[1], ${secondaryColor}[2], 1.0]", conditions : [ - ["${id} < 250", "${expression}"], - ["${id} < 500", "${expression} * ${expression}"], - ["${id} < 750", "${expression} / 5.0"], - ["${id} < 1000", "rgb(0, 0, Number(${expression}[0] < 0.5) * 255)"] + ["${id} < 250", "vec4(${secondaryColor}, 1.0)"], + ["${id} < 500", "vec4(${secondaryColor} * ${secondaryColor}, 1.0)"], + ["${id} < 750", "vec4(${secondaryColor} / 5.0, 1.0)"], + ["${id} < 1000", "rgb(0, 0, Number(${secondaryColor}.x < 0.5) * 255)"] ] } }); @@ -174,8 +178,9 @@ show : "${POSITION}[0] > 0.5 || ${POSITION}[1] > 0.5 || ${POSITION}[2] > 0.5" }); +// POSITION contains 0 as its last component, so add 1.0 to make the point cloud opaque addStyle('Color based on position', { - color : "rgb(${POSITION}[0] * 255, ${POSITION}[1] * 255, ${POSITION}[2] * 255)" + color : "vec4(${POSITION}, 1.0)" }); addStyle('Style point size', { diff --git a/Apps/Sandcastle/gallery/3D Tiles.html b/Apps/Sandcastle/gallery/3D Tiles.html index 02d63e7a2564..31ddde20c5ed 100644 --- a/Apps/Sandcastle/gallery/3D Tiles.html +++ b/Apps/Sandcastle/gallery/3D Tiles.html @@ -119,6 +119,10 @@ //console.log('Loading: requests: ' + numberOfPendingRequests + ', processing: ' + numberProcessing); }); + tileset.allTilesLoaded.addEventListener(function() { + //console.log('All tiles are loaded'); + }); + tileset.tileUnload.addEventListener(function(tile) { //console.log('Tile unloaded.') }); @@ -375,6 +379,10 @@ tileset.debugColorizeTiles = !tileset.debugColorizeTiles; }); +Sandcastle.addToolbarButton('Wireframe on/off', function() { + tileset.debugWireframe = !tileset.debugWireframe; +}); + Sandcastle.addToolbarButton('BV on/off', function() { tileset.debugShowBoundingVolume = !tileset.debugShowBoundingVolume; }); diff --git a/Apps/Sandcastle/gallery/CZML Billboard and Label.html b/Apps/Sandcastle/gallery/CZML Billboard and Label.html index dc6e1521d663..37889f6d28ca 100644 --- a/Apps/Sandcastle/gallery/CZML Billboard and Label.html +++ b/Apps/Sandcastle/gallery/CZML Billboard and Label.html @@ -42,19 +42,19 @@ }, "label" : { "fillColor" : { - "rgba" : [0, 255, 255, 255] + "rgba" : [255, 255, 255, 255] }, - "font" : "11pt Lucida Console", + "font" : "12pt Lucida Console", "horizontalOrigin" : "LEFT", - "outlineColor" : { - "rgba":[0, 0, 0, 255] - }, - "outlineWidth" : 2, "pixelOffset" : { - "cartesian2" : [12, 0] + "cartesian2" : [8, 0] }, - "style" : "FILL_AND_OUTLINE", - "text" : "AGI" + "style" : "FILL", + "text" : "AGI", + "showBackground" : true, + "backgroundColor" : { + "rgba" : [112, 89, 57, 200] + } }, "position" : { "cartesian":[ @@ -65,7 +65,7 @@ var viewer = new Cesium.Viewer('cesiumContainer'); viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)); - //Sandcastle_End +//Sandcastle_End Sandcastle.finishedLoading(); } if (typeof Cesium !== "undefined") { diff --git a/Apps/Sandcastle/gallery/CZML.html b/Apps/Sandcastle/gallery/CZML.html index 0cafcad8932f..5a02e79f2bbb 100644 --- a/Apps/Sandcastle/gallery/CZML.html +++ b/Apps/Sandcastle/gallery/CZML.html @@ -42,8 +42,7 @@ viewer.scene.camera.setView({ destination: Cesium.Cartesian3.fromDegrees(-116.52, 35.02, 95000), orientation: { - heading: 6, - picth: -Cesium.Math.PI_OVER_TWO + heading: 6 } }); }); diff --git a/Apps/Sandcastle/gallery/Custom Geocoder.html b/Apps/Sandcastle/gallery/Custom Geocoder.html new file mode 100644 index 000000000000..b1f388c92db4 --- /dev/null +++ b/Apps/Sandcastle/gallery/Custom Geocoder.html @@ -0,0 +1,90 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+ + + \ No newline at end of file diff --git a/Apps/Sandcastle/gallery/Ground Clamping.html b/Apps/Sandcastle/gallery/Ground Clamping.html index d4081e1d8b1f..81c1d41a123b 100644 --- a/Apps/Sandcastle/gallery/Ground Clamping.html +++ b/Apps/Sandcastle/gallery/Ground Clamping.html @@ -10,10 +10,10 @@ @@ -29,8 +29,8 @@
diff --git a/Apps/Sandcastle/gallery/Labels.html b/Apps/Sandcastle/gallery/Labels.html index 0cbe6839a575..2c4b4b4b7f96 100644 --- a/Apps/Sandcastle/gallery/Labels.html +++ b/Apps/Sandcastle/gallery/Labels.html @@ -64,6 +64,7 @@ }); entity.label.scale = 2.0; + entity.label.showBackground = true; } function offsetByDistance() { @@ -80,6 +81,7 @@ label : { text : 'Label on top of scaling billboard', font : '20px sans-serif', + showBackground : true, horizontalOrigin : Cesium.HorizontalOrigin.CENTER, pixelOffset : new Cesium.Cartesian2(0.0, -image.height), pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5) diff --git a/Apps/Sandcastle/gallery/Materials.html b/Apps/Sandcastle/gallery/Materials.html index 4837b977d00f..ef0f13c94f12 100644 --- a/Apps/Sandcastle/gallery/Materials.html +++ b/Apps/Sandcastle/gallery/Materials.html @@ -202,6 +202,29 @@ }); } +function applyCompressedTextureMaterial(primitive, scene) { + Sandcastle.declare(applyCompressedTextureMaterial); // For highlighting in Sandcastle. + + var compressedImageUrl; + var context = scene.context; + if (context.s3tc) { + compressedImageUrl = '../images/LogoDXT1.ktx'; + } else if (context.etc1) { + compressedImageUrl = '../images/LogoETC1.ktx'; + } else if (context.pvrtc) { + compressedImageUrl = '../images/LogoPVR.ktx'; + } + + primitive.appearance.material = new Cesium.Material({ + fabric : { + type : 'Image', + uniforms : { + image : compressedImageUrl + } + } + }); +} + function applyNormalMapMaterial(primitive, scene) { Sandcastle.declare(applyNormalMapMaterial); // For highlighting in Sandcastle. primitive.appearance.material = new Cesium.Material({ @@ -310,6 +333,13 @@ applyImageMaterial(rectangle, scene); Sandcastle.highlight(applyImageMaterial); } + }, { + text : 'Compressed Image', + onselect : function() { + toggleRectangleVisibility(); + applyCompressedTextureMaterial(rectangle, scene); + Sandcastle.highlight(applyCompressedTextureMaterial); + } }]); Sandcastle.addToolbarMenu([{ diff --git a/Apps/Sandcastle/gallery/Offline.html b/Apps/Sandcastle/gallery/Offline.html new file mode 100644 index 000000000000..36d02c454644 --- /dev/null +++ b/Apps/Sandcastle/gallery/Offline.html @@ -0,0 +1,52 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Offline.jpg b/Apps/Sandcastle/gallery/Offline.jpg new file mode 100644 index 000000000000..7ab0c0b70bc2 Binary files /dev/null and b/Apps/Sandcastle/gallery/Offline.jpg differ diff --git a/Apps/Sandcastle/gallery/Picking.html b/Apps/Sandcastle/gallery/Picking.html index 22c7c73ff95a..6ae7162463fe 100644 --- a/Apps/Sandcastle/gallery/Picking.html +++ b/Apps/Sandcastle/gallery/Picking.html @@ -38,7 +38,12 @@ Sandcastle.addDefaultToolbarButton('Show Cartographic Position on Mouse Over', function() { var entity = viewer.entities.add({ label : { - show : false + show : false, + showBackground : true, + font : '14px monospace', + horizontalOrigin : Cesium.HorizontalOrigin.LEFT, + verticalOrigin : Cesium.VerticalOrigin.TOP, + pixelOffset : new Cesium.Cartesian2(15, 0) } }); @@ -53,7 +58,9 @@ entity.position = cartesian; entity.label.show = true; - entity.label.text = '(' + longitudeString + ', ' + latitudeString + ')'; + entity.label.text = + 'Lon: ' + (' ' + longitudeString).slice(-7) + '\u00B0' + + '\nLat: ' + (' ' + latitudeString).slice(-7) + '\u00B0'; } else { entity.label.show = false; } @@ -159,7 +166,11 @@ var labelEntity = viewer.entities.add({ label : { show : false, - horizontalOrigin : Cesium.HorizontalOrigin.LEFT + showBackground : true, + font : '14px monospace', + horizontalOrigin : Cesium.HorizontalOrigin.LEFT, + verticalOrigin : Cesium.VerticalOrigin.TOP, + pixelOffset : new Cesium.Cartesian2(15, 0) } }); @@ -181,8 +192,11 @@ labelEntity.position = cartesian; labelEntity.label.show = true; - labelEntity.label.text = '(' + longitudeString + ', ' + latitudeString + ', ' + heightString + ')'; - + labelEntity.label.text = + 'Lon: ' + (' ' + longitudeString).slice(-7) + '\u00B0' + + '\nLat: ' + (' ' + latitudeString).slice(-7) + '\u00B0' + + '\nAlt: ' + (' ' + heightString).slice(-7) + 'm'; + var camera = scene.camera; labelEntity.label.eyeOffset = new Cesium.Cartesian3(0.0, 0.0, camera.frustum.near * 1.5 - Cesium.Cartesian3.distance(cartesian, camera.position)); @@ -201,7 +215,7 @@ handler = handler && handler.destroy(); }; //Sandcastle_End -Sandcastle.finishedLoading(); + Sandcastle.finishedLoading(); } if (typeof Cesium !== "undefined") { startup(Cesium); diff --git a/Apps/Sandcastle/gallery/Rectangle.html b/Apps/Sandcastle/gallery/Rectangle.html index 02f20c1c8229..7861a1cc0262 100644 --- a/Apps/Sandcastle/gallery/Rectangle.html +++ b/Apps/Sandcastle/gallery/Rectangle.html @@ -42,7 +42,7 @@ var greenRectangle = viewer.entities.add({ name : 'Green translucent, rotated, and extruded rectangle at height with outline', rectangle : { - coordinates : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0), + coordinates : Cesium.Rectangle.fromDegrees(-110.0, 30.0, -100.0, 40.0), material : Cesium.Color.GREEN.withAlpha(0.5), rotation : Cesium.Math.toRadians(45), extrudedHeight : 300000.0, @@ -52,6 +52,22 @@ } }); +var rotation = Cesium.Math.toRadians(30); + +function getRotationValue() { + rotation += 0.005; + return rotation; +} +viewer.entities.add({ + name: 'Rotating rectangle with rotating texture coordinate', + rectangle: { + coordinates: Cesium.Rectangle.fromDegrees(-92.0, 30.0, -76.0, 40.0), + material: '../images/Cesium_Logo_Color.jpg', + rotation: new Cesium.CallbackProperty(getRotationValue, false), + stRotation: new Cesium.CallbackProperty(getRotationValue, false) + } +}); + viewer.zoomTo(viewer.entities); //Sandcastle_End Sandcastle.finishedLoading(); diff --git a/Apps/Sandcastle/gallery/Rectangle.jpg b/Apps/Sandcastle/gallery/Rectangle.jpg index 3aa5238d6ea8..eac9a0ba48f4 100644 Binary files a/Apps/Sandcastle/gallery/Rectangle.jpg and b/Apps/Sandcastle/gallery/Rectangle.jpg differ diff --git a/Apps/Sandcastle/gallery/Terrain.html b/Apps/Sandcastle/gallery/Terrain.html index 6346ceb11117..09eedd03e1c4 100644 --- a/Apps/Sandcastle/gallery/Terrain.html +++ b/Apps/Sandcastle/gallery/Terrain.html @@ -148,11 +148,14 @@ }, label : { text : position.height.toFixed(1), + font : '10pt monospace', horizontalOrigin : Cesium.HorizontalOrigin.CENTER, - scale : 0.3, pixelOffset : new Cesium.Cartesian2(0, -14), - fillColor : Cesium.Color.RED, - outlineColor : Cesium.Color.WHITE + fillColor : Cesium.Color.BLACK, + outlineColor : Cesium.Color.BLACK, + showBackground : true, + backgroundColor : new Cesium.Color(0.9, 0.9, 0.9, 0.7), + backgroundPadding : new Cesium.Cartesian2(4, 3) } }); } diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index 0504f5af2a7b..ffc969e4dc54 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -19,16 +19,107 @@

Loading...

-
+
+ + + + + + + + + + + + + + + + + +
Mode
Color
Alpha + + +
Mix + + +
+