-
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 tweaks #6327
Clipping planes tweaks #6327
Conversation
@likangning93, thanks for the pull request! Maintainers, we have a signed CLA from @likangning93, so you can review this at any time.
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Discussion offline, might be better to move the "many clipping planes" demo to Terrain Clipping Planes and remove the drawing portion. |
It might make sense to move |
…ove ClippingPlane to Scene
I'm not sure when the bug was introduced, but in It looks like this is just a bug in the Sandcastle code. |
|
||
var demos = ['Cesium Man', 'St. Helens']; |
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.
For consistency rename to exampleTypes
.
|
||
// Create centerpoints for each clipping plane | ||
var clippingPlanes = []; | ||
for (var i = 0; i < pointCount; i++) { |
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.
Style: rename pointCount
to pointsLength
.
Change i++
to ++i
|
||
var pointCount = points.length; | ||
|
||
// Create centerpoints for each clipping plane |
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.
Change centerpoints
to center points
.
}; | ||
var toolbar = document.getElementById('toolbar'); | ||
Cesium.knockout.track(viewModel); | ||
Cesium.knockout.applyBindings(viewModel, toolbar); | ||
|
||
// For tracking state when switching demos | ||
var clippingPlanesEnabled = true; |
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.
This one isn't being used.
CHANGES.md
Outdated
@@ -15,6 +15,8 @@ Change Log | |||
* Added a `ClippingPlane` object to be used with `ClippingPlaneCollection`. | |||
* Updated `WebMapServiceImageryProvider` so it can take an srs or crs string to pass to the resource query parameters based on the WMS version. [#6223](https://github.com/AnalyticalGraphicsInc/cesium/issues/6223) | |||
* Added a multi-part CZML example to Sandcastle. [#6320](https://github.com/AnalyticalGraphicsInc/cesium/pull/6320) | |||
* Added `AttributeCompression.octEncodeToCartesian4` and `AttributeCompression.octDecodeFromCartesian4` which will encode and decode unit-length normal vectors using 4 `uint8` components in a `Cartesian4`. |
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.
This shouldn't be mentioned in CHANGES.md
because the class is private.
Source/Scene/ClippingPlane.js
Outdated
@@ -25,6 +25,9 @@ define([ | |||
* opposite to the normal; if zero, the plane passes through the origin. | |||
*/ | |||
function ClippingPlane(normal, distance) { | |||
Check.typeOf.object('normal', normal); | |||
Check.typeOf.number('distance', distance); |
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.
Wrap these 2 lines in
//>>includeStart('debug', pragmas.debug);
//>>includeEnd('debug');
Source/Scene/ClippingPlane.js
Outdated
z : makeGetterStter('z') | ||
x : makeGetterSetter('x'), | ||
y : makeGetterSetter('y'), | ||
z : makeGetterSetter('z') |
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.
I would actually just heed @pjcozzi's advice here and not do the separate makeGetterSetter
that I had suggested, just in case. #6201 (comment)
@@ -90,8 +90,7 @@ define([ | |||
} | |||
} | |||
|
|||
this._enabled = false; | |||
this.enabled = defaultValue(options.enabled, true); // set using setter | |||
this._enabled = defaultValue(options.enabled, true); |
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.
I noticed that the default value of the setter is documented as false
but it should be true
.
@@ -1,18 +1,16 @@ | |||
define([ |
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.
@@ -374,7 +374,7 @@ defineSuite([ | |||
' 0.0, 2.0, 0.0, 0.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.
Also add any other new builtins here, including unpackFloat
.
Another thing to fix: I noticed that when a model is constructed with a |
Example code:
|
@lilleyse updated! Color on model construction should be fixed too. |
CHANGES.md
Outdated
@@ -15,6 +15,7 @@ Change Log | |||
* Added a `ClippingPlane` object to be used with `ClippingPlaneCollection`. | |||
* Updated `WebMapServiceImageryProvider` so it can take an srs or crs string to pass to the resource query parameters based on the WMS version. [#6223](https://github.com/AnalyticalGraphicsInc/cesium/issues/6223) | |||
* Added a multi-part CZML example to Sandcastle. [#6320](https://github.com/AnalyticalGraphicsInc/cesium/pull/6320) | |||
* Added 3D Tiles use-case to Terrain Clipping Planes Sandcastle |
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.
'../Core/Cartesian4', | ||
'../Core/Math', | ||
'../Core/Check', | ||
'../Scene/ClippingPlane', |
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.
This one is out of order.
@@ -1,18 +1,18 @@ | |||
define([ | |||
'../Core/ClippingPlaneCollection', | |||
'../Core/defined', | |||
'../Core/destroyObject', | |||
'../Core/TerrainQuantization', | |||
'../Renderer/ShaderProgram', | |||
'../Scene/SceneMode', |
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.
Unrelated to this PR, but for consistency this one should be changed to ./SceneMode
'Core/AttributeCompression', | ||
'Core/BoundingSphere', | ||
'Core/Cartesian2', | ||
'Core/Cartesian3', | ||
'Core/Cartesian4', | ||
'Core/ClippingPlane', | ||
'Scene/ClippingPlane', |
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.
Same issue with Scene/ClippingPlaneCollection
and Scene/ClippingPlane
here.
@@ -1,5 +1,5 @@ | |||
defineSuite([ | |||
'Core/ClippingPlane', | |||
'Scene/ClippingPlane', |
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.
Here too.
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.
Whoops, I thought the define for the class being tested had to be first, but I hadn't looked at, say, the spec for Scene
...
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.
@likangning93 you are correct, the define for the class being tested does need to be first (because of Cesium specifics).
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.
Yup sorry, I overlooked this case.
Just those small things. Otherwise looks ready to go. |
@lilleyse updated! |
Ok looks good. Thanks for all the changes! |
CC #6201 (review)