Skip to content

Commit

Permalink
fix ie
Browse files Browse the repository at this point in the history
  • Loading branch information
hpinkos committed Jun 27, 2018
1 parent 138f59c commit b2a8d75
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@ define([
attributes : attributes,
indices : attr.indices,
primitiveType : PrimitiveType.TRIANGLES,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : corridorGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/CorridorOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ define([
attributes : attributes,
indices : attr.indices,
primitiveType : PrimitiveType.LINES,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : corridorOutlineGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/EllipseGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,8 @@ define([
attributes : geometry.attributes,
indices : geometry.indices,
primitiveType : PrimitiveType.TRIANGLES,
boundingSphere : geometry.boundingSphere
boundingSphere : geometry.boundingSphere,
offsetAttribute : ellipseGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/EllipseOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ define([
attributes : geometry.attributes,
indices : geometry.indices,
primitiveType : PrimitiveType.LINES,
boundingSphere : geometry.boundingSphere
boundingSphere : geometry.boundingSphere,
offsetAttribute : ellipseGeometry._offsetAttribute
});
};

Expand Down
8 changes: 8 additions & 0 deletions Source/Core/Geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ define([
'./defaultValue',
'./defined',
'./DeveloperError',
'./GeometryOffsetAttribute',
'./GeometryType',
'./Matrix2',
'./Matrix3',
Expand All @@ -22,6 +23,7 @@ define([
defaultValue,
defined,
DeveloperError,
GeometryOffsetAttribute,
GeometryType,
Matrix2,
Matrix3,
Expand Down Expand Up @@ -176,6 +178,12 @@ define([
* @private
*/
this.boundingSphereCV = options.boundingSphereCV;

/**
* @private
* Used for computing the bounding sphere for geometry using the applyOffset vertex attribute
*/
this.offsetAttribute = options.offsetAttribute;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/PolygonGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@ define([
attributes : attributes,
indices : geometry.indices,
primitiveType : geometry.primitiveType,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : polygonGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/PolygonOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ define([
attributes : geometry.attributes,
indices : geometry.indices,
primitiveType : geometry.primitiveType,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : polygonGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/RectangleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,8 @@ define([
attributes : geometry.attributes,
indices : geometry.indices,
primitiveType : geometry.primitiveType,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : rectangleGeometry._offsetAttribute
});
};

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/RectangleOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ define([
attributes : geometry.attributes,
indices : geometry.indices,
primitiveType : PrimitiveType.LINES,
boundingSphere : boundingSphere
boundingSphere : boundingSphere,
offsetAttribute : rectangleGeometry._offsetAttribute
});
};

Expand Down
11 changes: 7 additions & 4 deletions Source/Scene/Primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ define([
'../Core/Geometry',
'../Core/GeometryAttribute',
'../Core/GeometryAttributes',
'../Core/GeometryOffsetAttribute',
'../Core/Intersect',
'../Core/isArray',
'../Core/Matrix4',
Expand Down Expand Up @@ -61,6 +62,7 @@ define([
Geometry,
GeometryAttribute,
GeometryAttributes,
GeometryOffsetAttribute,
Intersect,
isArray,
Matrix4,
Expand Down Expand Up @@ -526,7 +528,7 @@ define([
var name;

for (name in attributes0) {
if (attributes0.hasOwnProperty(name)) {
if (attributes0.hasOwnProperty(name) && defined(attributes0[name])) {
var attribute = attributes0[name];
var inAllInstances = true;

Expand Down Expand Up @@ -1893,13 +1895,13 @@ define([

var offsetBoundingSphereScratch1 = new BoundingSphere();
var offsetBoundingSphereScratch2 = new BoundingSphere();
function transformBoundingSphere(boundingSphere, offset, extend) {
if (extend) {
function transformBoundingSphere(boundingSphere, offset, offsetAttribute) {
if (offsetAttribute === GeometryOffsetAttribute.TOP) {
var origBS = BoundingSphere.clone(boundingSphere, offsetBoundingSphereScratch1);
var offsetBS = BoundingSphere.clone(boundingSphere, offsetBoundingSphereScratch2);
offsetBS.center = Cartesian3.add(offsetBS.center, offset, offsetBS.center);
boundingSphere = BoundingSphere.union(origBS, offsetBS, boundingSphere);
} else {
} else if (offsetAttribute === GeometryOffsetAttribute.ALL) {
boundingSphere.center = Cartesian3.add(boundingSphere.center, offset, boundingSphere.center);
}

Expand Down Expand Up @@ -1943,6 +1945,7 @@ define([
get : function() {
var boundingSphere = primitive._instanceBoundingSpheres[index];
if (defined(boundingSphere)) {
boundingSphere = boundingSphere.clone();
var modelMatrix = primitive.modelMatrix;
var offset = properties.offset;
if (defined(offset)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PrimitivePipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ define([
boundingSpheres[i] = geometry.boundingSphere;
boundingSpheresCV[i] = geometry.boundingSphereCV;
if (hasOffset) {
offsetInstanceExtend[i] = defined(instance.geometry.attributes) && defined(instance.geometry.attributes.applyOffset) && instance.geometry.attributes.applyOffset.values.indexOf(0) !== -1;
offsetInstanceExtend[i] = instance.geometry.offsetAttribute;
}
}

Expand Down

0 comments on commit b2a8d75

Please sign in to comment.