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

Fix busted ellipsoid bounding spheres #4907

Merged
merged 2 commits into from
Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions Source/DataSources/dynamicGeometryGetBoundingSphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,20 @@ define([
//>>includeEnd('debug');

var attributes;
var modelMatrix;

//Outline and Fill geometries have the same bounding sphere, so just use whichever one is defined and ready
if (defined(primitive) && primitive.show && primitive.ready) {
attributes = primitive.getGeometryInstanceAttributes(entity);
if (defined(attributes) && defined(attributes.boundingSphere)) {
modelMatrix = defaultValue(primitive.modelMatrix, Matrix4.IDENTITY);
BoundingSphere.transform(attributes.boundingSphere, modelMatrix, result);
BoundingSphere.clone(attributes.boundingSphere, result);
return BoundingSphereState.DONE;
}
}

if (defined(outlinePrimitive) && outlinePrimitive.show && outlinePrimitive.ready) {
attributes = outlinePrimitive.getGeometryInstanceAttributes(entity);
if (defined(attributes) && defined(attributes.boundingSphere)) {
modelMatrix = defaultValue(outlinePrimitive.modelMatrix, Matrix4.IDENTITY);
BoundingSphere.transform(attributes.boundingSphere, modelMatrix, result);
BoundingSphere.clone(attributes.boundingSphere, result);
return BoundingSphereState.DONE;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Specs/createDynamicGeometryBoundingSphereSpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ define([
var primitive = scene.primitives.get(0);
expect(state).toBe(BoundingSphereState.DONE);
var attributes = primitive.getGeometryInstanceAttributes(entity);
expect(result).toEqualEpsilon(BoundingSphere.transform(attributes.boundingSphere, primitive.modelMatrix, new BoundingSphere()), CesiumMath.EPSILON6);
expect(result).toEqualEpsilon(attributes.boundingSphere, CesiumMath.EPSILON6);

updater.destroy();
scene.primitives.removeAll();
Expand All @@ -62,7 +62,7 @@ define([
var primitive = scene.primitives.get(0);
expect(state).toBe(BoundingSphereState.DONE);
var attributes = primitive.getGeometryInstanceAttributes(entity);
expect(result).toEqualEpsilon(BoundingSphere.transform(attributes.boundingSphere, primitive.modelMatrix, new BoundingSphere()), CesiumMath.EPSILON6);
expect(result).toEqualEpsilon(attributes.boundingSphere, CesiumMath.EPSILON6);

updater.destroy();
scene.primitives.removeAll();
Expand Down