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

Clipping Planes- Terrain & optimizations, and/or option, plane primitives, edge highlighting #5996

Merged
merged 42 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d188014
Add plane geometry
ggetz Nov 6, 2017
8ef6754
Merge branch 'clipping-planes-tileset-traversal' into clipping-planes…
ggetz Nov 6, 2017
51f28d0
Merge branch 'clipping-planes-tileset-traversal' into clipping-planes…
ggetz Nov 8, 2017
d142b0f
Added plane graphics and geometries, update clipping planes example
ggetz Nov 9, 2017
4dfea3a
Cleanup
ggetz Nov 9, 2017
ee8b97a
Update sandcastle demo, colors and scenario
ggetz Nov 10, 2017
33eb86a
Clipping planes on terrain
ggetz Nov 12, 2017
951a33b
Modified shaders to highlight clipping edge
ggetz Nov 13, 2017
8981779
Add demo
ggetz Nov 13, 2017
a0932d5
Merge branch 'clipping-planes-edge-styling' into clipping-planes-terr…
ggetz Nov 13, 2017
c0ec2c4
Add highlighting to terrain edges
ggetz Nov 13, 2017
5ec1058
Multiple clipping planes && together, define terrain clipping plane o…
ggetz Nov 14, 2017
48190c7
Merge branch 'clipping-planes-terrain-and-highlight-edges' into clipp…
ggetz Nov 17, 2017
443f73a
Add ClippingPlaneCollection
ggetz Nov 17, 2017
910e1c6
Fixed scaling in demo
ggetz Nov 17, 2017
6d67925
Optimize globe tile loading with clipping planes
ggetz Nov 20, 2017
086a03b
Cleanup docs
ggetz Nov 21, 2017
af21899
Updated CHANGES.md
ggetz Nov 21, 2017
7487847
Tweak doc
ggetz Nov 21, 2017
ea2d8da
Merge remote-tracking branch 'cesium/clip-planes-master' into clippin…
ggetz Nov 22, 2017
227698c
Update Sandcastle example, fix sandcastle images
ggetz Nov 22, 2017
e8e14f2
Refactor clipping planes
ggetz Nov 27, 2017
4a37690
Fix Plane geometry classes
ggetz Nov 27, 2017
93a2940
Fix doc
ggetz Nov 27, 2017
8d41a56
Pixel width for edge highlighting, fix model transforms
ggetz Nov 27, 2017
b4c9a8d
Point cloud clipping fix
ggetz Nov 27, 2017
627b8d4
Update clipping planes example
ggetz Nov 27, 2017
fd151a0
Indent includes
lilleyse Nov 28, 2017
5b75ee5
Cleanup and add plane geometry sandcastle example
ggetz Nov 29, 2017
92fc2bb
Fix failing tests
ggetz Nov 30, 2017
0af0db6
Specs
ggetz Nov 30, 2017
77457f5
Fix errors
ggetz Nov 30, 2017
47e0ec3
Cleanup, update specs
ggetz Dec 1, 2017
5680c34
Fix plane geometry surface
ggetz Dec 1, 2017
21c96e9
Draw commands in specs
ggetz Dec 1, 2017
3b069ca
Model and PlaneGeometry Specs
ggetz Dec 1, 2017
82a2780
Cleanup
ggetz Dec 1, 2017
ca40033
i3dm tileset in specs
ggetz Dec 1, 2017
31079f7
Added i3dm tilesets
ggetz Dec 1, 2017
b83e288
i3dm specs
ggetz Dec 1, 2017
2d855b8
Add instanced tileset to sandcastle example
ggetz Dec 2, 2017
c8cd6fa
Tweak sandcastle example
ggetz Dec 4, 2017
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
6 changes: 3 additions & 3 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ define([
'../Core/RequestType',
'../Core/RuntimeError',
'../Renderer/Pass',
'../Scene/ClippingPlanesCollection',
'./Cesium3DTileBatchTable',
'./Cesium3DTileFeature',
'./Cesium3DTileFeatureTable',
'./ClippingPlanesCollection',
'./getAttributeOrUniformBySemantic',
'./Model'
], function(
Expand All @@ -36,10 +36,10 @@ define([
RequestType,
RuntimeError,
Pass,
ClippingPlanesCollections,
Cesium3DTileBatchTable,
Cesium3DTileFeature,
Cesium3DTileFeatureTable,
ClippingPlanesCollection,
getAttributeOrUniformBySemantic,
Model) {
'use strict';
Expand Down Expand Up @@ -380,7 +380,7 @@ define([
pickUniformMapLoaded : batchTable.getPickUniformMapCallback(),
addBatchIdToGeneratedShaders : (batchLength > 0), // If the batch table has values in it, generated shaders will need a batchId attribute
pickObject : pickObject,
clippingPlanes : new ClippingPlanesCollections({
clippingPlanes : new ClippingPlanesCollection({
enabled : false
})
});
Expand Down
12 changes: 10 additions & 2 deletions Source/Scene/ClippingPlanesCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,20 @@ define([
}

var length = this.planes.length;
var i;
if (result.planes.length !== length) {
result.planes = new Array(length);

for (i = 0; i < length; ++i) {
result.planes[i] = new Plane(Cartesian3.UNIT_X, 0.0);
}
}
for (var i = 0; i < length; ++i) {

for (i = 0; i < length; ++i) {
var plane = this.planes[i];
result.planes[i] = new Plane(plane.normal, plane.distance);
var resultPlane = result.planes[i];
resultPlane.normal = plane.normal;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use Cartesian3.clone here, with resultPlane.normal as the result.

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind I see that this is already in.

resultPlane.distance = plane.distance;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't notice this before - since clone is called every frame it should do its best to avoid allocating a new array and new planes since result will usually already have planes.

result.enabled = this.enabled;
Expand Down
15 changes: 14 additions & 1 deletion Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define([
'./Cesium3DTileBatchTable',
'./Cesium3DTileFeature',
'./Cesium3DTileFeatureTable',
'./ClippingPlanesCollection',
'./ModelInstanceCollection'
], function(
AttributeCompression,
Expand Down Expand Up @@ -55,6 +56,7 @@ define([
Cesium3DTileBatchTable,
Cesium3DTileFeature,
Cesium3DTileFeatureTable,
ClippingPlanesCollection,
ModelInstanceCollection) {
'use strict';

Expand Down Expand Up @@ -443,7 +445,6 @@ define([
var modelMatrix = instanceTransform.clone();
instances[i] = {
modelMatrix : modelMatrix,
batchId : batchId
};
}

Expand Down Expand Up @@ -514,6 +515,18 @@ define([
this._modelInstanceCollection.debugWireframe = this._tileset.debugWireframe;
this._modelInstanceCollection.update(frameState);

// Update clipping planes
var tilesetClippingPlanes = this._tileset.clippingPlanes;
if (defined(tilesetClippingPlanes)) {
var model = this._modelInstanceCollection._model;
if (!defined(model.clippingPlanes)) {
model.clippingPlanes = new ClippingPlanesCollection();
}

tilesetClippingPlanes.clone(model.clippingPlanes);
model.clippingPlanes.enabled = tilesetClippingPlanes.enabled && this._tile._isClipped;
}

// If any commands were pushed, add derived commands
var commandEnd = frameState.commandList.length;
if ((commandStart < commandEnd) && frameState.passes.render) {
Expand Down