-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Clipping planes for models, tilesets, point clouds #5913
Changes from 1 commit
05a4387
5d0d22e
cb685e4
5512b11
ff35a7d
c3945d1
9252ad5
2b342c0
7a56927
1513f0c
d25a825
8642cf7
f843aa3
d9a2c56
bb4c63f
5be9ef6
973ae3a
7d6cba2
1c101a8
b01ffa9
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 |
---|---|---|
|
@@ -72,14 +72,13 @@ | |
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
|
||
var defaultClippingPlanes = [ | ||
new Cesium.Plane(Cesium.Cartesian3.UNIT_X, 0), | ||
new Cesium.Plane(Cesium.Cartesian3.UNIT_Y, 0), | ||
new Cesium.Plane(Cesium.Cartesian3.UNIT_Z, 0) | ||
new Cesium.Plane(new Cesium.Cartesian3(-1, 0, 0), 0.0), | ||
new Cesium.Plane(new Cesium.Cartesian3(0, -1, 0), 100.0), | ||
new Cesium.Plane(new Cesium.Cartesian3(0, 0, 1), 100.0) | ||
]; | ||
|
||
function loadTileset (url) { | ||
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. Throughout, no space before |
||
viewer.entities.removeAll(); | ||
viewer.scene.primitives.removeAll(); | ||
reset(); | ||
|
||
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ | ||
url : url | ||
|
@@ -98,10 +97,9 @@ | |
} | ||
|
||
function loadModel (url) { | ||
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. It is an awkward design to have the In |
||
viewer.entities.removeAll(); | ||
viewer.scene.primitives.removeAll(); | ||
reset(); | ||
|
||
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 1.0); | ||
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 100.0); | ||
var heading = Cesium.Math.toRadians(135); | ||
var pitch = 0; | ||
var roll = 0; | ||
|
@@ -136,8 +134,8 @@ | |
exampleType : 'BIM', | ||
exampleTypes : ['BIM', 'Model', 'Point Cloud'], | ||
xOffset : 0.0, | ||
yOffset: 0.0, | ||
zOffset: 0.0 | ||
yOffset: 100.0, | ||
zOffset: 100.0 | ||
}; | ||
var toolbar = document.getElementById('toolbar'); | ||
Cesium.knockout.track(viewModel); | ||
|
@@ -167,6 +165,17 @@ | |
} | ||
); | ||
|
||
function reset () { | ||
viewer.entities.removeAll(); | ||
viewer.scene.primitives.removeAll(); | ||
|
||
if (Cesium.defined(viewModel)) { | ||
viewModel.xOffset = 0.0; | ||
viewModel.yOffset = 100.0; | ||
viewModel.zOffset = 100.0; | ||
} | ||
} | ||
|
||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* 6 | ||
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. Provide a description here instead of just the number. |
||
* | ||
* @name czm_maxClippingPlanes | ||
* @glslConstant | ||
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. Add |
||
*/ | ||
const int czm_maxClippingPlanes = 6; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,9 @@ | |
* @name czm_clipPlanes | ||
* @glslFunction | ||
* | ||
* @param {vec4[]} clippingPlanes The array of planes used to clip, defined in in eyespace. | ||
* @param {vec4[]} clippingPlanes The array of planes used to clip, defined in eyespace. | ||
* @param {int} clippingPlanesLength The number of planes in the array of clipping planes. | ||
*/ | ||
const int czm_maxClippingPlanes = 6; | ||
|
||
void czm_clipPlanes (vec4[czm_maxClippingPlanes] clippingPlanes, int clippingPlanesLength) | ||
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. Name this a verb, e.g., |
||
{ | ||
if (clippingPlanesLength > 0) | ||
|
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.
Throughout, add
.0
to numbers that are intended to be floating point.