Skip to content

Revert adjustZPlanes globe change #3014

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

Merged
merged 12 commits into from
Jan 11, 2022
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
2 changes: 1 addition & 1 deletion common/api/core-frontend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ export class BackgroundMapGeometry {
// (undocumented)
getEarthEllipsoid(radiusOffset?: number): Ellipsoid;
// (undocumented)
getFrustumIntersectionDepthRange(frustum: Frustum, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d;
getFrustumIntersectionDepthRange(frustum: Frustum, bimRange: Range3d, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d;
// (undocumented)
getPlane(offset?: number): Plane3dByOriginAndUnitNormal;
// (undocumented)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
4 changes: 2 additions & 2 deletions core/frontend/src/BackgroundMapGeometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class BackgroundMapGeometry {
}

/** @internal */
public getFrustumIntersectionDepthRange(frustum: Frustum, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {
public getFrustumIntersectionDepthRange(frustum: Frustum, bimRange: Range3d, heightRange?: Range1d, gridPlane?: Plane3dByOriginAndUnitNormal, doGlobalScope?: boolean): Range1d {
const clipPlanes = frustum.getRangePlanes(false, false, 0);
const eyePoint = frustum.getEyePoint(scratchEyePoint);
const viewRotation = frustum.getRotation(scratchViewRotation);
Expand Down Expand Up @@ -272,7 +272,7 @@ export class BackgroundMapGeometry {
scratchSilhouetteNormal.negate(scratchSilhouetteNormal);
} else {
/* If parallel projection - clip toward side of ellipsoid with BIM geometry */
if (viewZ.dotProduct(scratchSilhouetteNormal) < 0)
if (Vector3d.createStartEnd(silhouette.center, bimRange.center).dotProduct(scratchSilhouetteNormal) < 0)
scratchSilhouetteNormal.negate(scratchSilhouetteNormal);
}
clipPlanes.planes.push(ClipPlane.createNormalAndDistance(scratchSilhouetteNormal, scratchSilhouetteNormal.dotProduct(silhouette.center))!);
Expand Down
2 changes: 1 addition & 1 deletion core/frontend/src/ViewingSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class ViewingSpace {
const viewZ = this.rotation.getRow(2);
const eyeDepth = this.eyePoint ? viewZ.dotProduct(this.eyePoint) : undefined;

depthRange = globalGeometry.geometry.getFrustumIntersectionDepthRange(frustum, globalGeometry.heightRange, gridPlane, this.view.maxGlobalScopeFactor > 1);
depthRange = globalGeometry.geometry.getFrustumIntersectionDepthRange(frustum, extents, globalGeometry.heightRange, gridPlane, this.view.maxGlobalScopeFactor > 1);

if (eyeDepth !== undefined) {
const maxBackgroundFrontBackRatio = 1.0E6;
Expand Down
2 changes: 1 addition & 1 deletion core/frontend/src/render/webgl/SolarShadowMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class SolarShadowMap implements RenderMemory.Consumer, WebGLDisposable {
mapToWorld.multiplyPoint3dArrayQuietNormalize(scratchFrustum.points); // This frustum represents the shadwowing geometry. Intersect it with background geometry and expand the range depth to include that intersection.
const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();
if (undefined !== backgroundMapGeometry) {
const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum);
const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum, iModel.projectExtents);
if (!backgroundDepthRange.isNull)
shadowRange.low.z = Math.min(shadowRange.low.z, backgroundDepthRange.low);
}
Expand Down