-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Per-feature post-processing #6476
Changes from all commits
601841c
0875b17
43d2b45
6a159eb
c6781a3
1766464
77826df
d36507e
8c4d392
82bf70b
8408c7f
bca8eda
1599d31
e5ca775
5616502
6879b96
cb38405
d1dd710
4daa234
98f280b
8f2d660
eb66871
fc19067
cefe1d8
8c6e4c4
c912b25
a87ee51
15d796e
63e3f5b
2cf7fab
effb7c5
05e83d2
6b54601
f5ebf96
3a04a35
9ef51fa
4771073
15d7f7e
675e6d4
b5c71e2
0f5f189
cdb00a4
8959e7c
96d3916
f6ccb68
d88c2ee
d01201d
664f72f
d38bbbf
428abde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Post processing effects."> | ||
<meta name="cesium-sandcastle-labels" content="Showcases, Post Processing"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/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> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer', { | ||
shouldAnimate : true | ||
}); | ||
|
||
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706); | ||
var url = '../../SampleData/models/CesiumMan/Cesium_Man.glb'; | ||
viewer.trackedEntity = viewer.entities.add({ | ||
name : url, | ||
position : position, | ||
model : { | ||
uri : url | ||
} | ||
}); | ||
|
||
var collection = viewer.scene.postProcessStages; | ||
var silhouette = collection.add(Cesium.PostProcessStageLibrary.createSilhouetteStage()); | ||
silhouette.uniforms.color = Cesium.Color.LIME; | ||
var blackAndWhite = collection.add(Cesium.PostProcessStageLibrary.createBlackAndWhiteStage()); | ||
blackAndWhite.uniforms.gradations = 5.0; | ||
|
||
if (!silhouette.isSupported(viewer.scene)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it odd that a user needs to create an instance to check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How else would it work? There isn't a class for each of the stages. If there was, we could do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe: if (!Cesium.PostProcessStageLibrary.isSilhouetteSupported(viewer.scene)) { Slightly more coupled, but cleaner for the end user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, db5cb75 |
||
console.log('This browser does not support the silhouette post process.'); | ||
} | ||
|
||
var handler; | ||
function addMouseOver(stage) { | ||
handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); | ||
handler.setInputAction(function(movement) { | ||
var pickedObject = viewer.scene.pick(movement.endPosition); | ||
if (Cesium.defined(pickedObject)) { | ||
stage.selectedFeatures = [pickedObject.primitive]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure Maybe just |
||
} else { | ||
stage.selectedFeatures = []; | ||
} | ||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | ||
} | ||
|
||
function removeMouseOver(stage) { | ||
handler = handler && handler.destroy(); | ||
stage.selectedFeatures = []; | ||
} | ||
|
||
Sandcastle.addToolbarMenu([{ | ||
text : 'Mouse-over Black and White', | ||
onselect : function() { | ||
blackAndWhite.enabled = true; | ||
silhouette.enabled = false; | ||
|
||
removeMouseOver(silhouette); | ||
addMouseOver(blackAndWhite); | ||
} | ||
}, { | ||
text : 'Mouse-over Silhouette', | ||
onselect : function() { | ||
blackAndWhite.enabled = false; | ||
silhouette.enabled = true; | ||
|
||
removeMouseOver(blackAndWhite); | ||
addMouseOver(silhouette); | ||
} | ||
}]); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collection
?Be precise.
What should be the canonical name used throughout?
stages
, right?