Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Globe depth texture #2506

Merged
merged 179 commits into from
May 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
42e4b8d
Automatic globe depth texture uniform WIP.
bagnell Feb 20, 2015
75c7b7e
Fix OIT.
bagnell Feb 20, 2015
836525a
Fix FXAA and texture changed tests.
bagnell Feb 20, 2015
e45c6ae
Fix picking and multifrustum tests.
bagnell Feb 20, 2015
851f5ba
Add path if framebuffer cannot be created. Add test for czm_globeDept…
bagnell Feb 20, 2015
f863026
Fix doc
pjcozzi Feb 21, 2015
4234b92
Merge branch 'master' into globe-depth
pjcozzi Feb 28, 2015
7a3b72d
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi Mar 1, 2015
7068771
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi Mar 2, 2015
ea14b36
Merge branch 'master' into globe-depth
bagnell Mar 3, 2015
da896c5
Properly clean up textures and fbos in resize.
bagnell Mar 3, 2015
96ec329
Updates from review and some clean up.
bagnell Mar 3, 2015
c517422
Merge branch 'master' into globe-depth
bagnell Mar 9, 2015
8dd9c45
Merge branch 'master' into globe-depth
bagnell Mar 10, 2015
29bffa1
Fix for disabling OIT at the scene level.
bagnell Mar 11, 2015
a0bd017
Merge branch 'master' into globe-depth
bagnell Mar 11, 2015
f9e2ddb
Move globe depth framebuffers and commands out of Scene.
bagnell Mar 12, 2015
1951d40
Clean up unused members in Scene.
bagnell Mar 12, 2015
0aca330
Fix FXAA when OIT is disabled.
bagnell Mar 12, 2015
c37e26f
Properly destroy WebGL resources.
bagnell Mar 12, 2015
e750be4
Merge branch 'master' into globe-depth
bagnell Mar 17, 2015
9071ec7
Fix tests after merge.
bagnell Mar 17, 2015
8e827a9
Fix picking when depth textures are not available and enable FXAA by …
bagnell Mar 18, 2015
f527f07
Use pass through shader with depth texture to copy globe depth.
bagnell Mar 18, 2015
1a53ed0
Update Sandcastle examples that have geometry with outlines.
bagnell Mar 18, 2015
45a75a6
Declare commands and properly release shaders.
bagnell Mar 18, 2015
9cc2bdb
Update CHANGES.md.
bagnell Mar 18, 2015
0d5e547
Updates from review.
bagnell Mar 18, 2015
e309a5b
Rename _depthStencilGlobeTest to _globeDepthTexture.
bagnell Mar 19, 2015
8841604
Avoid extra fullscreen draw call when not using OIT.
bagnell Mar 19, 2015
3bf734a
Merge branch 'master' into globe-depth
bagnell Mar 24, 2015
3aa52ce
Added option to show globe depth to CesiumInspector.
fstoner Mar 26, 2015
6cea1f2
Interrim updates.
fstoner Mar 30, 2015
000eccc
Adding comments to command execution.
fstoner Mar 30, 2015
14377ef
More comments for scene rendering functions.
fstoner Mar 30, 2015
0fdaec2
Merge branch 'master' into globe-depth
bagnell Apr 1, 2015
1a2f182
Moving rendering to scene.
fstoner Apr 2, 2015
d5170de
Have single frustum working now.
fstoner Apr 3, 2015
ae2cbca
Simplifying fragment shader.
fstoner Apr 3, 2015
deb198a
Using monochrome color scheme.
fstoner Apr 3, 2015
d8afb6c
Adding some variations to the shader program.
fstoner Apr 6, 2015
8efe092
Added option to show globe depth to CesiumInspector.
fstoner Mar 26, 2015
336e544
Interrim updates.
fstoner Mar 30, 2015
095840c
Adding comments to command execution.
fstoner Mar 30, 2015
36fa31f
More comments for scene rendering functions.
fstoner Mar 30, 2015
4725fce
Moving rendering to scene.
fstoner Apr 2, 2015
a0d932c
Have single frustum working now.
fstoner Apr 3, 2015
b9f2e42
Simplifying fragment shader.
fstoner Apr 3, 2015
afbdcb3
Using monochrome color scheme.
fstoner Apr 3, 2015
a52da5c
Adding some variations to the shader program.
fstoner Apr 6, 2015
96c9984
Merge branch 'globe-depth-debug-view' of github.com:fstoner/cesium in…
fstoner Apr 7, 2015
eb1f904
Adding frustum selectors to UI.
fstoner Apr 7, 2015
e7f309b
Connecting frustum selector.
fstoner Apr 7, 2015
09d050f
Removing dependency on frustum statistics.
fstoner Apr 8, 2015
b5d1cf0
Better document construction.
fstoner Apr 8, 2015
97ad62f
Some tweaks.
fstoner Apr 8, 2015
1398091
More cleanup.
fstoner Apr 8, 2015
845f2e7
More cleanup.
fstoner Apr 8, 2015
fbe4385
Making globe depth debug objects private.
fstoner Apr 8, 2015
45b0851
Updated CHANGES.md.
fstoner Apr 8, 2015
ff5f02e
Clean up comments
pjcozzi Apr 8, 2015
32feca4
Removed extraneous comment.
fstoner Apr 9, 2015
66ccd94
Cleaning up shader program destruction.
fstoner Apr 9, 2015
7374fb9
Removing commented out shader code.
fstoner Apr 9, 2015
0e12444
Exposing Scene.numberOfFrustums as a private property.
fstoner Apr 9, 2015
44a4fee
Making show globe depth frustum info update independent of show.
fstoner Apr 9, 2015
a8d07bc
Fixing typos for "frame buffer".
fstoner Apr 9, 2015
82fb5b2
Removing use of frustum "slice".
fstoner Apr 9, 2015
9854329
Refraining from creating the viewport command with each update.
fstoner Apr 9, 2015
697bd05
Moving debug show-globe-depth functionality to GlobeDepth.
fstoner Apr 9, 2015
2593b41
Interim modifications.
fstoner Apr 9, 2015
ddea8cf
Some framebuffer manipulation.
fstoner Apr 9, 2015
8d7f4f8
Removing unused code.
fstoner Apr 10, 2015
f5905e4
More cleanup of GlobeDepth.
fstoner Apr 10, 2015
14f30d7
Adding spec for debugShowGlobeDepth.
fstoner Apr 10, 2015
7a05287
More code cleanup.
fstoner Apr 10, 2015
1b2e5d2
Tweak doc
pjcozzi Apr 10, 2015
75803ce
Allowing for contrast contral of globe depth.
fstoner Apr 14, 2015
985d552
Increasing contrast in debug globe depth shader.
fstoner Apr 14, 2015
de3423f
Adding frech scene creation to failing tests.
fstoner Apr 14, 2015
871f3af
A better fix for the failing tests.
fstoner Apr 14, 2015
de77bb9
Merge pull request #2625 from fstoner/globe-depth-debug-view
pjcozzi Apr 14, 2015
23bd672
Merge branch 'master' into globe-depth
bagnell Apr 15, 2015
19f3ff9
Clamp billboards to ground WIP.
bagnell Apr 16, 2015
45265e3
Hook up callbacks when loading tiles in the quadtree. Billboards on t…
bagnell Apr 16, 2015
db403b6
Update quadtree callbacks when billboards are added or removed.
bagnell Apr 17, 2015
b7137f5
Move clamp control from billboard collection to billboard.
bagnell Apr 17, 2015
ac3aee2
Track clamped position differently from user provided position.
bagnell Apr 17, 2015
5298834
Improve performance by not updating entire quadtree when adding or re…
bagnell Apr 17, 2015
6abe6ed
Fix clamping to billboards to ground in 2D, Columbus view and when mo…
bagnell Apr 20, 2015
83f5dc3
Only use one vertex texture fetch for the depth at the center of the …
bagnell Apr 20, 2015
aa31bce
Merge branch 'master' into globe-depth
bagnell Apr 20, 2015
cc013c4
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell Apr 20, 2015
9a76c64
Throttle billboards clamped to terrain to only pick the mesh in the g…
bagnell Apr 20, 2015
4583516
Add clamp to ground option to labels.
bagnell Apr 21, 2015
8840623
Clean up picking a terrain tile's mesh and fix billboards when create…
bagnell Apr 21, 2015
f115094
Use the frame number when updating callbacks for rendered tiles inste…
bagnell Apr 21, 2015
27df468
Clamp the entire label instead of the individual billboards of the la…
bagnell Apr 21, 2015
8ce9101
Check the last frame rendered and only use callbacks when a tile tran…
bagnell Apr 21, 2015
0acc702
Improve performance. Associate data with the quadtree that will updat…
bagnell Apr 22, 2015
fefe944
Change clampToGround boolean to heightReference with enum that can be…
bagnell Apr 23, 2015
1bdde11
Change method for determining billboard visibility.
bagnell Apr 24, 2015
e70d140
Add Sandcastle example clamping billboards to the ground.
bagnell Apr 24, 2015
55cc7d3
Add attribute to billboards to compute label visibility.
bagnell Apr 28, 2015
0ae305a
Only update billboard position on terrain loaded.
bagnell Apr 28, 2015
b25eac7
Remove updating the billboard on tile load. Update the position on ti…
bagnell Apr 28, 2015
8d3377c
Fix updating height reference and changine position. Fixed columbus v…
bagnell Apr 28, 2015
ae61e7a
Update Sandcastle example.
bagnell Apr 29, 2015
b941902
Some updates base don review.
bagnell Apr 29, 2015
3f719dd
Merge branch 'master' into globe-depth
bagnell Apr 29, 2015
6fefe5b
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell Apr 29, 2015
2b5ae80
Rename maxSize to ownerSize. Update labels and other changes based on…
bagnell Apr 29, 2015
220f3b2
More renames and updates based on review.
bagnell Apr 29, 2015
2ff3d43
Add doc.
bagnell Apr 29, 2015
6c722f9
Update computing screen space position for billboards and labels.
bagnell Apr 29, 2015
9b1f561
Move time slicing code from the billboard/label collection to the qua…
bagnell May 1, 2015
0b2a63a
Stop updating billboards/labels when the height for the lowest level …
bagnell May 1, 2015
26d6ad5
Fix updating billboard/label height reference and position.
bagnell May 4, 2015
d9061fb
Rename from review.
bagnell May 4, 2015
fb7901e
Update Sandcastle example.
bagnell May 4, 2015
344619d
Update doc.
bagnell May 4, 2015
f68c78b
Improve update performance.
bagnell May 4, 2015
1770da4
Update labels/billboards when the terrain provider changes.
bagnell May 4, 2015
9f7f1ab
Fix ciolumbus view. Clean up requires.
bagnell May 5, 2015
58980dc
Re-add eye z offset.
bagnell May 5, 2015
3b7c13b
Add tests for billboards/labels with height references and for the qu…
bagnell May 7, 2015
7ca6a16
Merge branch 'master' into globe-depth
bagnell May 7, 2015
83fd26d
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell May 7, 2015
9fff44c
Update CHANGES.md
bagnell May 7, 2015
94dc317
Merge pull request #2653 from AnalyticalGraphicsInc/billboard-clamp-t…
pjcozzi May 7, 2015
0b999f5
Copy the depth buffer after each frustum renders for later picking.
bagnell May 11, 2015
a7fe0cd
Return world space position of pick. Compress depth into unsigned byt…
bagnell May 12, 2015
9df4e83
Merge branch 'master' into globe-depth
bagnell May 12, 2015
8677981
Merge branch 'globe-depth' into pick-depth
bagnell May 12, 2015
d1f2205
Pick the depth buffer for mouse controls by default.
bagnell May 12, 2015
d65f2ca
Add doc and use result parameters.
bagnell May 12, 2015
a97dd5b
Throw if pickDepth is called but not supported. Update CHANGES.md.
bagnell May 12, 2015
48027b4
Remove unecessary error checking code. Move depth packing to its own …
bagnell May 13, 2015
e93c6ad
Pack depth value into an unsigned byte for wider support and less mem…
bagnell May 14, 2015
63c07fe
Clean up screen space camera controller.
bagnell May 14, 2015
feb7e5a
Fix tests.
bagnell May 14, 2015
cf077a9
Add pickDepth test.
bagnell May 14, 2015
ed2c987
Merge branch 'master' into globe-depth
bagnell May 14, 2015
bc0be76
Merge branch 'globe-depth' into pick-depth
bagnell May 14, 2015
e905b6a
Clean up OIT after globe depth updates.
bagnell May 14, 2015
a061907
Fix jsHint error.
bagnell May 14, 2015
71440c7
Use closest point from picking depth buffer and ray intersection with…
bagnell May 14, 2015
69907e0
Add Sandcastle example for picking the depth buffer.
bagnell May 14, 2015
ef1b657
Updates from review.
bagnell May 14, 2015
a2b07b4
Tweak picking depth. Update Sandcastle example to not use labels.
bagnell May 18, 2015
dfb64a4
Pick the position closest to the camera position when picking depth. …
bagnell May 19, 2015
5c772f3
Fix packing/unpacking depth values from RGBA buffer.
bagnell May 20, 2015
5db24b9
Merge branch 'master' into globe-depth
bagnell May 21, 2015
94acf1d
Merge branch 'globe-depth' into pick-depth
bagnell May 21, 2015
b76e13d
Fix clamping billboards to the ground after depth buffer packing chan…
bagnell May 21, 2015
5a7208f
Update Sandcastle example based on review.
bagnell May 21, 2015
d261529
Clean up picking Sandcastle example.
bagnell May 21, 2015
fe5c0cf
Fix missed rename and change pickDepth -> pickPosition.
bagnell May 21, 2015
027ccab
Add Scene.pickPositionSupported.
bagnell May 21, 2015
23937ee
Sandcastle example rename
pjcozzi May 21, 2015
a65515f
Adjust eye offset in picking Sandcastle example.
bagnell May 22, 2015
2415333
Remove commented code.
bagnell May 22, 2015
6604aff
Remove unecessary undefined check.
bagnell May 22, 2015
54a2b86
Merge pull request #2700 from AnalyticalGraphicsInc/pick-depth
pjcozzi May 22, 2015
6413fbe
Merge branch 'master' into globe-depth
bagnell May 27, 2015
9c188bd
Fixes after merge from master.
bagnell May 27, 2015
7f0f8d6
Remove billboard depth test in the vertex shader. Use fixed function …
bagnell May 27, 2015
4a362bb
Remove owner size attribute for doing manual depth test on labels.
bagnell May 27, 2015
8a3773c
Do not copy the globe depth by default.
bagnell May 27, 2015
9e5a39b
Remove owner size attribute from vertex shader.
bagnell May 27, 2015
286e853
Merge pull request #2755 from AnalyticalGraphicsInc/billboard-depth
pjcozzi May 27, 2015
a28ea65
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi May 27, 2015
9d6e86f
Fixes for CHANGES.md
pjcozzi May 27, 2015
3e7fe6b
Use bgltf model and remove commented code in development example.
bagnell May 27, 2015
8d769c1
Fix whitespace
pjcozzi May 27, 2015
d26e06b
Change based on review.
bagnell May 27, 2015
fbed6fb
Update CHANGES.md.
bagnell May 27, 2015
351c802
Add unit test for Scene.copyGlobeDepth.
bagnell May 27, 2015
73ad525
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi May 28, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Box.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
box : {
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
material : Cesium.Color.RED,
material : Cesium.Color.RED.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Circles and Ellipses.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
semiMajorAxis : 300000.0,
extrudedHeight : 200000.0,
rotation : Cesium.Math.toRadians(45),
material : Cesium.Color.BLUE.withAlpha(0.7),
material : Cesium.Color.BLUE.withAlpha(0.5),
outline : true
}
});
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Cylinders and Cones.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
length : 400000.0,
topRadius : 200000.0,
bottomRadius : 200000.0,
material : Cesium.Color.GREEN,
material : Cesium.Color.GREEN.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.DARK_GREEN
}
Expand Down
6 changes: 3 additions & 3 deletions Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
Sandcastle.addToolbarButton('Basic styling', function() {
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson', {
stroke: Cesium.Color.HOTPINK,
fill: Cesium.Color.PINK,
fill: Cesium.Color.PINK.withAlpha(0.5),
strokeWidth: 3
}));
});
Expand Down Expand Up @@ -72,8 +72,8 @@

//Set the polygon material to our random color.
entity.polygon.material = color;
//Outline each polygon in black.
entity.polygon.outlineColor = Cesium.Color.BLACK;
//Remove the outlines.
entity.polygon.outline = false;

//Extrude the polygon based on the state's population. Each entity
//stores the properties for the GeoJSON feature it was created from
Expand Down
44 changes: 44 additions & 0 deletions Apps/Sandcastle/gallery/Picking.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,50 @@
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.addToolbarButton('Pick position', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why we get negative altitudes right at the end of the model?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, its picking the depth plane. The regular pick to see if the model is under the mouse cursor checks a 3x3 pixel region. Picking the position only uses the center pixel.

var ellipsoid = scene.globe.ellipsoid;

var modelEntity = viewer.entities.add({
name : 'milktruck',
position : Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706),
model : {
uri : '../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.bgltf'
}
});
viewer.zoomTo(modelEntity);

var labelEntity = viewer.entities.add({
label : {
show : false,
horizontalOrigin : Cesium.HorizontalOrigin.LEFT
}
});

// Mouse over the globe to see the cartographic position
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
var scene = viewer.scene;
var pickedObject = scene.pick(movement.endPosition);
if (scene.pickPositionSupported && Cesium.defined(pickedObject) && pickedObject.id === modelEntity) {
var cartesian = viewer.scene.pickPosition(movement.endPosition);

var cartographic = ellipsoid.cartesianToCartographic(cartesian);
var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);
var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);
var heightString = cartographic.height.toFixed(2);

labelEntity.position = cartesian;
labelEntity.label.show = true;
labelEntity.label.text = '(' + longitudeString + ', ' + latitudeString + ', ' + heightString + ')';

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));
} else {
labelEntity.label.show = false;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
});

Sandcastle.reset = function() {
viewer.entities.removeAll();
handler = handler && handler.destroy();
Expand Down
4 changes: 2 additions & 2 deletions Apps/Sandcastle/gallery/Polygon.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
-108.0, 30.0, 300000]),
extrudedHeight: 0,
perPositionHeight : true,
material : Cesium.Color.ORANGE,
material : Cesium.Color.ORANGE.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand Down Expand Up @@ -100,7 +100,7 @@
}]
}]
},
material : Cesium.Color.BLUE,
material : Cesium.Color.BLUE.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand Down
6 changes: 2 additions & 4 deletions Apps/Sandcastle/gallery/Polyline Volume.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
new Cesium.Cartesian2(50000, 50000),
new Cesium.Cartesian2(-50000, 50000)],
cornerType : Cesium.CornerType.BEVELED,
material : Cesium.Color.GREEN,
material : Cesium.Color.GREEN.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand All @@ -85,9 +85,7 @@
-99.0, 36.0, 200000.0]),
shape : computeStar(7, 70000, 50000),
cornerType : Cesium.CornerType.MITERED,
material : Cesium.Color.BLUE,
outline : true,
outlineColor : Cesium.Color.BLACK
material : Cesium.Color.BLUE
}
});

Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Spheres and Ellipsoids.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
ellipsoid : {
radii : new Cesium.Cartesian3(300000.0, 300000.0, 300000.0),
material : Cesium.Color.RED,
material : Cesium.Color.RED.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand Down
6 changes: 2 additions & 4 deletions Apps/Sandcastle/gallery/Wall.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@
-97.0, 40.0, 100000.0,
-107.0, 40.0, 100000.0,
-107.0, 43.0, 100000.0]),
material : Cesium.Color.GREEN,
outline : true,
outlineColor : Cesium.Color.BLACK
material : Cesium.Color.GREEN
}
});

Expand All @@ -69,7 +67,7 @@
-90.0, 50.0]),
maximumHeights : [100000, 200000, 100000, 200000, 100000, 200000, 100000, 200000, 100000, 200000, 100000],
minimumHeights : [0, 100000, 0, 100000, 0, 100000, 0, 100000, 0, 100000, 0],
material : Cesium.Color.BLUE,
material : Cesium.Color.BLUE.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
Expand Down
143 changes: 143 additions & 0 deletions Apps/Sandcastle/gallery/development/BillboardClampToGround.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Clamp billboards to terrain.">
<meta name="cesium-sandcastle-labels" content="Development">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/require.js"></script>
<script type="text/javascript">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<div id="terrainMenu"></div>
<div id="zoomButtons"></div>
<div id="toggleLighting"></div>
<div id="sampleButtons"></div>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
"use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
url : '//assets.agi.com/stk-terrain/world'
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;
viewer.scene.globe.depthTestAgainstTerrain = true;

var ellipsoid = viewer.scene.globe.ellipsoid;
var billboardCollection = viewer.scene.primitives.add(new Cesium.BillboardCollection({
scene : viewer.scene
}));

// seneca
var centerLongitude = -1.385205433269729;
var centerLatitude = 0.6777926580888163;

var gridWidth = Math.floor(Math.random() * 100.0);
var gridHeight = Math.floor(Math.random() * 100.0);
var rectangleHalfSize = 0.0005;

var e = new Cesium.Rectangle(centerLongitude - rectangleHalfSize, centerLatitude - rectangleHalfSize, centerLongitude + rectangleHalfSize, centerLatitude + rectangleHalfSize);

for (var y = 0; y < gridHeight; ++y) {
for (var x = 0; x < gridWidth; ++x) {
var longitude = Cesium.Math.lerp(e.west, e.east, x / (gridWidth - 1));
var latitude = Cesium.Math.lerp(e.south, e.north, y / (gridHeight - 1));
var position = new Cesium.Cartographic(longitude, latitude);

billboardCollection.add({
position : ellipsoid.cartographicToCartesian(position),
image : '../images/facility.gif',
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND
});
}
}

var billboard;

Sandcastle.addToolbarButton('Add billboard', function() {
if (!Cesium.defined(billboard)) {
billboard = billboardCollection.add({
position : ellipsoid.cartographicToCartesian(new Cesium.Cartographic(centerLongitude, centerLatitude, 1000.0)),
image : '../images/Cesium_Logo_overlay.png',
scale : 0.7,
heightReference : Cesium.HeightReference.RELATIVE_TO_GROUND
});
}
});

Sandcastle.addToolbarButton('Remove billboard', function() {
if (Cesium.defined(billboard)) {
billboardCollection.remove(billboard);
billboard = undefined;
}
});

Sandcastle.addToolbarMenu([ {
text : 'Relative to ground',
onselect : function() {
if (Cesium.defined(billboard)) {
billboard.heightReference = Cesium.HeightReference.RELATIVE_TO_GROUND;
}
}
}, {
text : 'Clamp to ground',
onselect : function() {
if (Cesium.defined(billboard)) {
billboard.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND;
}
}
}, {
text : 'None',
onselect : function() {
if (Cesium.defined(billboard)) {
billboard.heightReference = Cesium.HeightReference.NONE;
}
}
}]);

var lonGran = 0.00005;

Sandcastle.addToolbarButton('Increase longitude', function() {
if (Cesium.defined(billboard)) {
var cartographic = ellipsoid.cartesianToCartographic(billboard.position);
cartographic.longitude += lonGran;
billboard.position = ellipsoid.cartographicToCartesian(cartographic);
}
});

Sandcastle.addToolbarButton('Decrease longitude', function() {
if (Cesium.defined(billboard)) {
var cartographic = ellipsoid.cartesianToCartographic(billboard.position);
cartographic.longitude -= lonGran;
billboard.position = ellipsoid.cartographicToCartesian(cartographic);
}
});

//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ Change Log
* Deprecated `Camera.clone`. It will be removed in 1.11.
* `WebMapServiceImageryProvider` constructor parameters `options.getFeatureInfoAsGeoJson` and `options.getFeatureInfoAsXml` have been deprecated and will be removed in Cesium 1.13. Use `options.getFeatureInfoFormats` instead.
* The Cesium sample models are now in the Binary glTF format (`.bgltf`). Cesium will also include the models as plain glTF (`.gltf`) until Cesium 1.13. Cesium support for `.gltf` will not be removed.
* Deprecated `Scene.fxaaOrderIndependentTranslucency`. Use `Scene.fxaa` which is now `true` by default.
* Added `Billboard.heightReference` and `Label.heightReference` to clamp billboards and labels to terrain.
* Added new `PointPrimitive` and `PointPrimitiveCollection`, which are faster and use less memory than billboards with circles.
* Changed `Entity.point` back-end graphics to use the new `PointPrimitive` instead of billboards. No change to the `Entity.point` API.
* Added optional drilling limit to `Scene.drillPick`.
* Added optional `ellipsoid` parameter to construction options of imagery and terrain providers that were lacking it. Note that terrain bounding spheres are precomputed on the server, so any supplied terrain ellipsoid must match the one used by the server.
* Upgraded Autolinker from version 0.15.2 to 0.17.1.
* Fixed documentation for `Context.drawingBufferHeight` and `Context.drawingBufferWidth`.
* Added debug option to `Scene` to show the depth buffer information for a specified view frustum slice and exposed capability in `CesiumInspector` widget.
* Added `Scene.pickPosition` to reconstruct the cartesian world position from window coordinates.
* The default mouse controls now support panning and zooming on 3D models and other opaque geometry.
* Added `Camera.moveStart` and `Camera.moveEnd` events.
* Added new leap second for 30 June 2015 at UTC 23:59:60.
* `KmlDataSource` can now load a KML file that uses explicit XML namespacing, e.g. `kml:Document`.
Expand Down
25 changes: 25 additions & 0 deletions Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,31 @@ define([
}
}),

/**
* An automatic GLSL uniform representing the depth after
* only the globe has been rendered and packed into an RGBA texture.
*
* @private
*
* @alias czm_globeDepthTexture
* @glslUniform
*
* @example
* // GLSL declaration
* uniform sampler2D czm_globeDepthTexture;
*
* // Get the depth at the current fragment
* vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
* float depth = czm_unpackDepth(texture2D(czm_globeDepthTexture, coords));
*/
czm_globeDepthTexture : new AutomaticUniform({
size : 1,
datatype : WebGLRenderingContext.SAMPLER_2D,
getValue : function(uniformState) {
return uniformState.globeDepthTexture;
}
}),

/**
* An automatic GLSL uniform representing a 4x4 model transformation matrix that
* transforms model coordinates to world coordinates.
Expand Down
8 changes: 4 additions & 4 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,10 @@ define([
},

/**
* The drawingBufferWidth of the underlying GL context.
* The drawingBufferHeight of the underlying GL context.
* @memberof Context.prototype
* @type {Number}
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferWidth|drawingBufferWidth}
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferHeight|drawingBufferHeight}
*/
drawingBufferHeight : {
get : function() {
Expand All @@ -921,10 +921,10 @@ define([
},

/**
* The drawingBufferHeight of the underlying GL context.
* The drawingBufferWidth of the underlying GL context.
* @memberof Context.prototype
* @type {Number}
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferHeight|drawingBufferHeight}
* @see {@link https://www.khronos.org/registry/webgl/specs/1.0/#DOM-WebGLRenderingContext-drawingBufferWidth|drawingBufferWidth}
*/
drawingBufferWidth : {
get : function() {
Expand Down
2 changes: 1 addition & 1 deletion Source/Renderer/PixelDatatype.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ define([
};

return freezeObject(PixelDatatype);
});
});
Loading