@itwin/core-frontend 5.2.0 → 5.3.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
  3. package/lib/cjs/ElementLocateManager.js +2 -5
  4. package/lib/cjs/ElementLocateManager.js.map +1 -1
  5. package/lib/cjs/HitDetail.d.ts +1 -24
  6. package/lib/cjs/HitDetail.d.ts.map +1 -1
  7. package/lib/cjs/HitDetail.js +0 -5
  8. package/lib/cjs/HitDetail.js.map +1 -1
  9. package/lib/cjs/IModeljs-css.js +1 -1
  10. package/lib/cjs/IModeljs-css.js.map +1 -1
  11. package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts +0 -2
  12. package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
  13. package/lib/cjs/internal/render/webgl/FrustumUniforms.js +0 -7
  14. package/lib/cjs/internal/render/webgl/FrustumUniforms.js.map +1 -1
  15. package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts +0 -9
  16. package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
  17. package/lib/cjs/internal/render/webgl/SceneCompositor.js +4 -67
  18. package/lib/cjs/internal/render/webgl/SceneCompositor.js.map +1 -1
  19. package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts +3 -4
  20. package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
  21. package/lib/cjs/internal/render/webgl/ShaderBuilder.js +3 -3
  22. package/lib/cjs/internal/render/webgl/ShaderBuilder.js.map +1 -1
  23. package/lib/cjs/internal/render/webgl/glsl/Atmosphere.js +1 -1
  24. package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
  25. package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.js +1 -2
  26. package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
  27. package/lib/cjs/internal/render/webgl/glsl/Contours.d.ts.map +1 -1
  28. package/lib/cjs/internal/render/webgl/glsl/Contours.js +1 -30
  29. package/lib/cjs/internal/render/webgl/glsl/Contours.js.map +1 -1
  30. package/lib/cjs/internal/render/webgl/glsl/Fragment.d.ts.map +1 -1
  31. package/lib/cjs/internal/render/webgl/glsl/Fragment.js +2 -7
  32. package/lib/cjs/internal/render/webgl/glsl/Fragment.js.map +1 -1
  33. package/lib/cjs/internal/render/webgl/glsl/RealityMesh.js +1 -1
  34. package/lib/cjs/internal/render/webgl/glsl/Surface.js +1 -1
  35. package/lib/cjs/render/Pixel.d.ts +2 -13
  36. package/lib/cjs/render/Pixel.d.ts.map +1 -1
  37. package/lib/cjs/render/Pixel.js +1 -9
  38. package/lib/cjs/render/Pixel.js.map +1 -1
  39. package/lib/esm/ElementLocateManager.d.ts.map +1 -1
  40. package/lib/esm/ElementLocateManager.js +2 -5
  41. package/lib/esm/ElementLocateManager.js.map +1 -1
  42. package/lib/esm/HitDetail.d.ts +1 -24
  43. package/lib/esm/HitDetail.d.ts.map +1 -1
  44. package/lib/esm/HitDetail.js +0 -5
  45. package/lib/esm/HitDetail.js.map +1 -1
  46. package/lib/esm/IModeljs-css.js +1 -1
  47. package/lib/esm/IModeljs-css.js.map +1 -1
  48. package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts +0 -2
  49. package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
  50. package/lib/esm/internal/render/webgl/FrustumUniforms.js +1 -8
  51. package/lib/esm/internal/render/webgl/FrustumUniforms.js.map +1 -1
  52. package/lib/esm/internal/render/webgl/SceneCompositor.d.ts +0 -9
  53. package/lib/esm/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
  54. package/lib/esm/internal/render/webgl/SceneCompositor.js +4 -67
  55. package/lib/esm/internal/render/webgl/SceneCompositor.js.map +1 -1
  56. package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts +3 -4
  57. package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
  58. package/lib/esm/internal/render/webgl/ShaderBuilder.js +3 -3
  59. package/lib/esm/internal/render/webgl/ShaderBuilder.js.map +1 -1
  60. package/lib/esm/internal/render/webgl/glsl/Atmosphere.js +1 -1
  61. package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
  62. package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.js +1 -2
  63. package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
  64. package/lib/esm/internal/render/webgl/glsl/Contours.d.ts.map +1 -1
  65. package/lib/esm/internal/render/webgl/glsl/Contours.js +1 -30
  66. package/lib/esm/internal/render/webgl/glsl/Contours.js.map +1 -1
  67. package/lib/esm/internal/render/webgl/glsl/Fragment.d.ts.map +1 -1
  68. package/lib/esm/internal/render/webgl/glsl/Fragment.js +2 -7
  69. package/lib/esm/internal/render/webgl/glsl/Fragment.js.map +1 -1
  70. package/lib/esm/internal/render/webgl/glsl/RealityMesh.js +1 -1
  71. package/lib/esm/internal/render/webgl/glsl/Surface.js +1 -1
  72. package/lib/esm/render/Pixel.d.ts +2 -13
  73. package/lib/esm/render/Pixel.d.ts.map +1 -1
  74. package/lib/esm/render/Pixel.js +1 -9
  75. package/lib/esm/render/Pixel.js.map +1 -1
  76. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  77. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  78. package/package.json +21 -22
@@ -31,7 +31,6 @@ class FrustumUniforms {
31
31
  // GPU state
32
32
  _planeData = new Float32Array(4);
33
33
  _frustumData = new Float32Array(3);
34
- _worldFrustumZRange = new Float32Array(2);
35
34
  projectionMatrix32 = new Matrix_1.Matrix4();
36
35
  _logZData = new Float32Array(2);
37
36
  _viewUpVector32 = new Float32Array(3);
@@ -44,7 +43,6 @@ class FrustumUniforms {
44
43
  viewX: new core_geometry_1.Vector3d(),
45
44
  viewY: new core_geometry_1.Vector3d(),
46
45
  viewZ: new core_geometry_1.Vector3d(),
47
- range: new core_geometry_1.Range3d(),
48
46
  };
49
47
  constructor() {
50
48
  }
@@ -60,8 +58,6 @@ class FrustumUniforms {
60
58
  get planes() { return this._planeData; }
61
59
  // uniform vec3 u_frustum; // { near, far, type }
62
60
  get frustum() { return this._frustumData; }
63
- // uniform vec2 u_worldFrustumZRange // { min, max }
64
- get worldFrustumZRange() { return this._worldFrustumZRange; }
65
61
  get nearPlane() { return this._frustumData[0 /* FrustumData.kNear */]; }
66
62
  get farPlane() { return this._frustumData[1 /* FrustumData.kFar */]; }
67
63
  get type() { return this.frustum[2 /* FrustumData.kType */]; }
@@ -74,9 +70,6 @@ class FrustumUniforms {
74
70
  return;
75
71
  (0, Sync_1.desync)(this);
76
72
  newFrustum.clone(this.planFrustum);
77
- const range = newFrustum.toRange(this._scratch.range);
78
- this._worldFrustumZRange[0] = range.low.z;
79
- this._worldFrustumZRange[1] = range.high.z;
80
73
  const farLowerLeft = newFrustum.getCorner(core_common_1.Npc.LeftBottomRear);
81
74
  const farLowerRight = newFrustum.getCorner(core_common_1.Npc.RightBottomRear);
82
75
  const farUpperLeft = newFrustum.getCorner(core_common_1.Npc.LeftTopRear);
@@ -1 +1 @@
1
- {"version":3,"file":"FrustumUniforms.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/FrustumUniforms.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8NH,8BAMC;AAlOD,sDAAoD;AACpD,wDAA2G;AAC3G,oDAAkD;AAElD,iEAA8D;AAC9D,qCAAmC;AACnC,iCAAsC;AAuBtC;;;GAGG;AACH,MAAa,eAAe;IAC1B,uCAAuC;IACvB,WAAW,GAAG,IAAI,qBAAO,EAAE,CAAC;IACpC,aAAa,GAAG,CAAC,CAAC;IACT,gBAAgB,GAAG,IAAI,uBAAO,EAAE,CAAC;IAClC,UAAU,GAAG,yBAAS,CAAC,cAAc,EAAE,CAAC;IACxC,gBAAgB,GAAG,wBA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Q,CAAC,eAAe,CACtB,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,EACxE,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,GAAG,EACxE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAC1E,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EACnB,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { expectDefined } from \"@itwin/core-bentley\";\r\nimport { InverseMatrixState, Matrix4d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Frustum, Npc } from \"@itwin/core-common\";\r\nimport { UniformHandle } from \"./UniformHandle\";\r\nimport { IModelFrameLifecycle } from \"./IModelFrameLifecycle\";\r\nimport { Matrix4 } from \"./Matrix\";\r\nimport { desync, sync } from \"./Sync\";\r\n\r\n/** @internal */\r\nexport const enum FrustumUniformType { // eslint-disable-line no-restricted-syntax\r\n TwoDee,\r\n Orthographic,\r\n Perspective,\r\n}\r\n\r\n/** @internal */\r\nexport const enum Plane { // eslint-disable-line no-restricted-syntax\r\n kTop,\r\n kBottom,\r\n kLeft,\r\n kRight,\r\n}\r\n\r\nconst enum FrustumData { // eslint-disable-line no-restricted-syntax\r\n kNear,\r\n kFar,\r\n kType,\r\n}\r\n\r\n/** Represents a Target's frustum for use in glsl as a pair of uniforms.\r\n * Do not modify fields of exposed objects directly. e.g., do not directly manipulate the projection or view matrices - use the appropriate APIs.\r\n * @internal\r\n */\r\nexport class FrustumUniforms {\r\n // CPU state. Do not modify - use APIs.\r\n public readonly planFrustum = new Frustum();\r\n private _planFraction = 0;\r\n private readonly _nearPlaneCenter = new Point3d();\r\n public readonly viewMatrix = Transform.createIdentity();\r\n public readonly projectionMatrix = Matrix4d.createIdentity();\r\n private readonly _worldUpVector = Vector3d.unitZ();\r\n private readonly _viewUpVector = Vector3d.unitZ();\r\n\r\n // GPU state\r\n private readonly _planeData: Float32Array = new Float32Array(4);\r\n private readonly _frustumData: Float32Array = new Float32Array(3);\r\n private readonly _worldFrustumZRange: Float32Array = new Float32Array(2);\r\n public readonly projectionMatrix32 = new Matrix4();\r\n private readonly _logZData = new Float32Array(2);\r\n private readonly _viewUpVector32 = new Float32Array(3);\r\n\r\n // SyncTarget\r\n public syncKey = 0;\r\n\r\n // Scratch variables\r\n private readonly _scratch = {\r\n point3d: new Point3d(),\r\n vec3d: new Vector3d(),\r\n viewX: new Vector3d(),\r\n viewY: new Vector3d(),\r\n viewZ: new Vector3d(),\r\n range: new Range3d(),\r\n };\r\n\r\n public constructor() {\r\n }\r\n\r\n public bindProjectionMatrix(uniform: UniformHandle): void {\r\n if (!sync(this, uniform))\r\n uniform.setMatrix4(this.projectionMatrix32);\r\n }\r\n\r\n public bindUpVector(uniform: UniformHandle): void {\r\n if (!sync(this, uniform))\r\n uniform.setUniform3fv(this._viewUpVector32);\r\n }\r\n\r\n // uniform vec4 u_frustumPlanes; // { top, bottom, left, right }\r\n public get planes(): Float32Array { return this._planeData; }\r\n\r\n // uniform vec3 u_frustum; // { near, far, type }\r\n public get frustum(): Float32Array { return this._frustumData; }\r\n\r\n // uniform vec2 u_worldFrustumZRange // { min, max }\r\n public get worldFrustumZRange(): Float32Array { return this._worldFrustumZRange; }\r\n\r\n public get nearPlane(): number { return this._frustumData[FrustumData.kNear]; }\r\n public get farPlane(): number { return this._frustumData[FrustumData.kFar]; }\r\n public get type(): FrustumUniformType { return this.frustum[FrustumData.kType] as FrustumUniformType; }\r\n public get is2d(): boolean { return FrustumUniformType.TwoDee === this.type; }\r\n public get planFraction(): number { return this._planFraction; }\r\n\r\n // uniform vec2 u_logZ where x = 1/near and y = log(far/near)\r\n public get logZ(): Float32Array { return this._logZData; }\r\n\r\n public changeFrustum(newFrustum: Frustum, newFraction: number, is3d: boolean): void {\r\n if (newFraction === this._planFraction && is3d !== this.is2d && newFrustum.equals(this.planFrustum))\r\n return;\r\n\r\n desync(this);\r\n\r\n newFrustum.clone(this.planFrustum);\r\n\r\n const range = newFrustum.toRange(this._scratch.range);\r\n this._worldFrustumZRange[0] = range.low.z;\r\n this._worldFrustumZRange[1] = range.high.z;\r\n\r\n const farLowerLeft = newFrustum.getCorner(Npc.LeftBottomRear);\r\n const farLowerRight = newFrustum.getCorner(Npc.RightBottomRear);\r\n const farUpperLeft = newFrustum.getCorner(Npc.LeftTopRear);\r\n const farUpperRight = newFrustum.getCorner(Npc.RightTopRear);\r\n const nearLowerLeft = newFrustum.getCorner(Npc.LeftBottomFront);\r\n const nearLowerRight = newFrustum.getCorner(Npc.RightBottomFront);\r\n const nearUpperLeft = newFrustum.getCorner(Npc.LeftTopFront);\r\n const nearUpperRight = newFrustum.getCorner(Npc.RightTopFront);\r\n\r\n const nearCenter = nearLowerLeft.interpolate(0.5, nearUpperRight, this._scratch.point3d);\r\n\r\n const viewX = normalizedDifference(nearLowerRight, nearLowerLeft, this._scratch.viewX);\r\n const viewY = normalizedDifference(nearUpperLeft, nearLowerLeft, this._scratch.viewY);\r\n const viewZ = expectDefined(viewX.crossProduct(viewY, this._scratch.viewZ).normalize());\r\n\r\n this._planFraction = newFraction;\r\n\r\n if (!is3d || newFraction > 0.999) { // ortho or 2d\r\n const halfWidth = Vector3d.createStartEnd(farLowerRight, farLowerLeft, this._scratch.vec3d).magnitude() * 0.5;\r\n const halfHeight = Vector3d.createStartEnd(farLowerRight, farUpperRight).magnitude() * 0.5;\r\n const depth = Vector3d.createStartEnd(farLowerLeft, nearLowerLeft, this._scratch.vec3d).magnitude();\r\n\r\n lookIn(nearCenter, viewX, viewY, viewZ, this.viewMatrix);\r\n ortho(-halfWidth, halfWidth, -halfHeight, halfHeight, 0, depth, this.projectionMatrix);\r\n\r\n this._nearPlaneCenter.setFrom(nearLowerLeft);\r\n this._nearPlaneCenter.interpolate(0.5, nearUpperRight, this._nearPlaneCenter);\r\n\r\n this.setPlanes(halfHeight, -halfHeight, -halfWidth, halfWidth);\r\n this.setFrustum(0, depth, is3d ? FrustumUniformType.Orthographic : FrustumUniformType.TwoDee);\r\n } else { // perspective\r\n const scale = 1.0 / (1.0 - newFraction);\r\n const zVec = Vector3d.createStartEnd(farLowerLeft, nearLowerLeft, this._scratch.vec3d);\r\n const cameraPosition = fromSumOf(farLowerLeft, zVec, scale, this._scratch.point3d);\r\n\r\n const frustumLeft = dotDifference(farLowerLeft, cameraPosition, viewX) * newFraction;\r\n const frustumRight = dotDifference(farLowerRight, cameraPosition, viewX) * newFraction;\r\n const frustumBottom = dotDifference(farLowerLeft, cameraPosition, viewY) * newFraction;\r\n const frustumTop = dotDifference(farUpperLeft, cameraPosition, viewY) * newFraction;\r\n const frustumFront = -dotDifference(nearLowerLeft, cameraPosition, viewZ);\r\n const frustumBack = -dotDifference(farLowerLeft, cameraPosition, viewZ);\r\n\r\n lookIn(cameraPosition, viewX, viewY, viewZ, this.viewMatrix);\r\n frustum(frustumLeft, frustumRight, frustumBottom, frustumTop, frustumFront, frustumBack, this.projectionMatrix);\r\n\r\n IModelFrameLifecycle.onChangeCameraView.raiseEvent({\r\n cameraPosition,\r\n viewX,\r\n viewY,\r\n viewZ,\r\n });\r\n IModelFrameLifecycle.onChangeCameraFrustum.raiseEvent({\r\n type: FrustumUniformType.Perspective,\r\n left: frustumLeft,\r\n right: frustumRight,\r\n bottom: frustumBottom,\r\n top: frustumTop,\r\n front: frustumFront,\r\n back: frustumBack,\r\n });\r\n\r\n this._nearPlaneCenter.setFrom(nearLowerLeft);\r\n this._nearPlaneCenter.interpolate(0.5, nearUpperRight, this._nearPlaneCenter);\r\n\r\n this.setPlanes(frustumTop, frustumBottom, frustumLeft, frustumRight);\r\n this.setFrustum(frustumFront, frustumBack, FrustumUniformType.Perspective);\r\n }\r\n\r\n this.viewMatrix.matrix.inverseState = InverseMatrixState.unknown;\r\n\r\n this.viewMatrix.matrix.multiplyVector(this._worldUpVector, this._viewUpVector);\r\n this._viewUpVector.normalizeInPlace();\r\n this._viewUpVector32[0] = this._viewUpVector.x;\r\n this._viewUpVector32[1] = this._viewUpVector.y;\r\n this._viewUpVector32[2] = this._viewUpVector.z;\r\n\r\n this.projectionMatrix32.initFromMatrix4d(this.projectionMatrix);\r\n }\r\n\r\n public changeProjectionMatrix(newMatrix: Matrix4d): void {\r\n desync(this);\r\n this.projectionMatrix.setFrom(newMatrix);\r\n this.projectionMatrix32.initFromMatrix4d(this.projectionMatrix);\r\n }\r\n\r\n protected setPlanes(top: number, bottom: number, left: number, right: number): void {\r\n this._planeData[Plane.kTop] = top;\r\n this._planeData[Plane.kBottom] = bottom;\r\n this._planeData[Plane.kLeft] = left;\r\n this._planeData[Plane.kRight] = right;\r\n }\r\n\r\n protected setFrustum(nearPlane: number, farPlane: number, type: FrustumUniformType): void {\r\n this._frustumData[FrustumData.kNear] = nearPlane;\r\n this._frustumData[FrustumData.kFar] = farPlane;\r\n this._frustumData[FrustumData.kType] = type as number;\r\n\r\n // If nearPlane is zero, we don't have a camera (or got very unlucky); in that case shader will compute linear depth.\r\n this._logZData[0] = 0 !== nearPlane ? 1 / nearPlane : 0;\r\n this._logZData[1] = 0 !== nearPlane ? Math.log(farPlane / nearPlane) : farPlane;\r\n }\r\n}\r\n\r\nfunction normalizedDifference(p0: Point3d, p1: Point3d, out?: Vector3d): Vector3d {\r\n const result = undefined !== out ? out : new Vector3d();\r\n result.x = p0.x - p1.x;\r\n result.y = p0.y - p1.y;\r\n result.z = p0.z - p1.z;\r\n result.normalizeInPlace();\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function fromSumOf(p: Point3d, v: Vector3d, scale: number, out?: Point3d) {\r\n const result = undefined !== out ? out : new Point3d();\r\n result.x = p.x + v.x * scale;\r\n result.y = p.y + v.y * scale;\r\n result.z = p.z + v.z * scale;\r\n return result;\r\n}\r\n\r\nfunction dotDifference(pt: Point3d, origin: Point3d, vec: Vector3d): number {\r\n return (pt.x - origin.x) * vec.x + (pt.y - origin.y) * vec.y + (pt.z - origin.z) * vec.z;\r\n}\r\n\r\nfunction lookIn(eye: Point3d, viewX: Vector3d, viewY: Vector3d, viewZ: Vector3d, result: Transform) {\r\n const rot = result.matrix.coffs;\r\n rot[0] = viewX.x;\r\n rot[1] = viewX.y;\r\n rot[2] = viewX.z;\r\n rot[3] = viewY.x;\r\n rot[4] = viewY.y;\r\n rot[5] = viewY.z;\r\n rot[6] = viewZ.x;\r\n rot[7] = viewZ.y;\r\n rot[8] = viewZ.z;\r\n\r\n result.origin.x = -viewX.dotProduct(eye);\r\n result.origin.y = -viewY.dotProduct(eye);\r\n result.origin.z = -viewZ.dotProduct(eye);\r\n}\r\n\r\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4d) {\r\n Matrix4d.createRowValues(\r\n 2.0 / (right - left), 0.0, 0.0, -(right + left) / (right - left),\r\n 0.0, 2.0 / (top - bottom), 0.0, -(top + bottom) / (top - bottom),\r\n 0.0, 0.0, -2.0 / (far - near), -(far + near) / (far - near),\r\n 0.0, 0.0, 0.0, 1.0,\r\n result);\r\n}\r\n\r\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4d) {\r\n Matrix4d.createRowValues(\r\n (2.0 * near) / (right - left), 0.0, (right + left) / (right - left), 0.0,\r\n 0.0, (2.0 * near) / (top - bottom), (top + bottom) / (top - bottom), 0.0,\r\n 0.0, 0.0, -(far + near) / (far - near), -(2.0 * far * near) / (far - near),\r\n 0.0, 0.0, -1.0, 0.0,\r\n result);\r\n}\r\n"]}
1
+ {"version":3,"file":"FrustumUniforms.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/FrustumUniforms.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAqNH,8BAMC;AAzND,sDAAoD;AACpD,wDAAkG;AAClG,oDAAkD;AAElD,iEAA8D;AAC9D,qCAAmC;AACnC,iCAAsC;AAuBtC;;;GAGG;AACH,MAAa,eAAe;IAC1B,uCAAuC;IACvB,WAAW,GAAG,IAAI,qBAAO,EAAE,CAAC;IACpC,aAAa,GAAG,CAAC,CAAC;IACT,gBAAgB,GAAG,IAAI,uBAAO,EAAE,CAAC;IAClC,UAAU,GAAG,yBAAS,CAAC,cAAc,EAAE,CAAC;IACxC,gBAAgB,GAAG,wBAAQ,CAAC,cAAc,EAAE,CAAC;IAC5C,cAAc,GAAG,wBAAQ,CAAC,KAAK,EAAE,CAAC;IAClC,aAAa,GAAG,wBAAQ,CAAC,KAAK,EAAE,CAAC;IAElD,YAAY;IACK,UAAU,GAAiB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/C,YAAY,GAAiB,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAClD,kBAAkB,GAAG,IAAI,gBAAO,EAAE,CAAC;IAClC,SAAS,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAChC,eAAe,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAEvD,aAAa;IACN,OAAO,GAAG,CAAC,CAAC;IAEnB,oBAAoB;IACH,QAAQ,GAAG;QAC1B,OAAO,EAAE,IAAI,uBAAO,EAAE;QACtB,KAAK,EAAE,IAAI,wBA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AAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAC3D,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAClB,MAAM,CAAC,CAAC;AACZ,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,GAAW,EAAE,IAAY,EAAE,GAAW,EAAE,MAAgB;IACpH,wBAAQ,CAAC,eAAe,CACtB,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,EACxE,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,GAAG,EACxE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAC1E,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EACnB,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { expectDefined } from \"@itwin/core-bentley\";\r\nimport { InverseMatrixState, Matrix4d, Point3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { Frustum, Npc } from \"@itwin/core-common\";\r\nimport { UniformHandle } from \"./UniformHandle\";\r\nimport { IModelFrameLifecycle } from \"./IModelFrameLifecycle\";\r\nimport { Matrix4 } from \"./Matrix\";\r\nimport { desync, sync } from \"./Sync\";\r\n\r\n/** @internal */\r\nexport const enum FrustumUniformType { // eslint-disable-line no-restricted-syntax\r\n TwoDee,\r\n Orthographic,\r\n Perspective,\r\n}\r\n\r\n/** @internal */\r\nexport const enum Plane { // eslint-disable-line no-restricted-syntax\r\n kTop,\r\n kBottom,\r\n kLeft,\r\n kRight,\r\n}\r\n\r\nconst enum FrustumData { // eslint-disable-line no-restricted-syntax\r\n kNear,\r\n kFar,\r\n kType,\r\n}\r\n\r\n/** Represents a Target's frustum for use in glsl as a pair of uniforms.\r\n * Do not modify fields of exposed objects directly. e.g., do not directly manipulate the projection or view matrices - use the appropriate APIs.\r\n * @internal\r\n */\r\nexport class FrustumUniforms {\r\n // CPU state. Do not modify - use APIs.\r\n public readonly planFrustum = new Frustum();\r\n private _planFraction = 0;\r\n private readonly _nearPlaneCenter = new Point3d();\r\n public readonly viewMatrix = Transform.createIdentity();\r\n public readonly projectionMatrix = Matrix4d.createIdentity();\r\n private readonly _worldUpVector = Vector3d.unitZ();\r\n private readonly _viewUpVector = Vector3d.unitZ();\r\n\r\n // GPU state\r\n private readonly _planeData: Float32Array = new Float32Array(4);\r\n private readonly _frustumData: Float32Array = new Float32Array(3);\r\n public readonly projectionMatrix32 = new Matrix4();\r\n private readonly _logZData = new Float32Array(2);\r\n private readonly _viewUpVector32 = new Float32Array(3);\r\n\r\n // SyncTarget\r\n public syncKey = 0;\r\n\r\n // Scratch variables\r\n private readonly _scratch = {\r\n point3d: new Point3d(),\r\n vec3d: new Vector3d(),\r\n viewX: new Vector3d(),\r\n viewY: new Vector3d(),\r\n viewZ: new Vector3d(),\r\n };\r\n\r\n public constructor() {\r\n }\r\n\r\n public bindProjectionMatrix(uniform: UniformHandle): void {\r\n if (!sync(this, uniform))\r\n uniform.setMatrix4(this.projectionMatrix32);\r\n }\r\n\r\n public bindUpVector(uniform: UniformHandle): void {\r\n if (!sync(this, uniform))\r\n uniform.setUniform3fv(this._viewUpVector32);\r\n }\r\n\r\n // uniform vec4 u_frustumPlanes; // { top, bottom, left, right }\r\n public get planes(): Float32Array { return this._planeData; }\r\n\r\n // uniform vec3 u_frustum; // { near, far, type }\r\n public get frustum(): Float32Array { return this._frustumData; }\r\n\r\n public get nearPlane(): number { return this._frustumData[FrustumData.kNear]; }\r\n public get farPlane(): number { return this._frustumData[FrustumData.kFar]; }\r\n public get type(): FrustumUniformType { return this.frustum[FrustumData.kType] as FrustumUniformType; }\r\n public get is2d(): boolean { return FrustumUniformType.TwoDee === this.type; }\r\n public get planFraction(): number { return this._planFraction; }\r\n\r\n // uniform vec2 u_logZ where x = 1/near and y = log(far/near)\r\n public get logZ(): Float32Array { return this._logZData; }\r\n\r\n public changeFrustum(newFrustum: Frustum, newFraction: number, is3d: boolean): void {\r\n if (newFraction === this._planFraction && is3d !== this.is2d && newFrustum.equals(this.planFrustum))\r\n return;\r\n\r\n desync(this);\r\n\r\n newFrustum.clone(this.planFrustum);\r\n\r\n const farLowerLeft = newFrustum.getCorner(Npc.LeftBottomRear);\r\n const farLowerRight = newFrustum.getCorner(Npc.RightBottomRear);\r\n const farUpperLeft = newFrustum.getCorner(Npc.LeftTopRear);\r\n const farUpperRight = newFrustum.getCorner(Npc.RightTopRear);\r\n const nearLowerLeft = newFrustum.getCorner(Npc.LeftBottomFront);\r\n const nearLowerRight = newFrustum.getCorner(Npc.RightBottomFront);\r\n const nearUpperLeft = newFrustum.getCorner(Npc.LeftTopFront);\r\n const nearUpperRight = newFrustum.getCorner(Npc.RightTopFront);\r\n\r\n const nearCenter = nearLowerLeft.interpolate(0.5, nearUpperRight, this._scratch.point3d);\r\n\r\n const viewX = normalizedDifference(nearLowerRight, nearLowerLeft, this._scratch.viewX);\r\n const viewY = normalizedDifference(nearUpperLeft, nearLowerLeft, this._scratch.viewY);\r\n const viewZ = expectDefined(viewX.crossProduct(viewY, this._scratch.viewZ).normalize());\r\n\r\n this._planFraction = newFraction;\r\n\r\n if (!is3d || newFraction > 0.999) { // ortho or 2d\r\n const halfWidth = Vector3d.createStartEnd(farLowerRight, farLowerLeft, this._scratch.vec3d).magnitude() * 0.5;\r\n const halfHeight = Vector3d.createStartEnd(farLowerRight, farUpperRight).magnitude() * 0.5;\r\n const depth = Vector3d.createStartEnd(farLowerLeft, nearLowerLeft, this._scratch.vec3d).magnitude();\r\n\r\n lookIn(nearCenter, viewX, viewY, viewZ, this.viewMatrix);\r\n ortho(-halfWidth, halfWidth, -halfHeight, halfHeight, 0, depth, this.projectionMatrix);\r\n\r\n this._nearPlaneCenter.setFrom(nearLowerLeft);\r\n this._nearPlaneCenter.interpolate(0.5, nearUpperRight, this._nearPlaneCenter);\r\n\r\n this.setPlanes(halfHeight, -halfHeight, -halfWidth, halfWidth);\r\n this.setFrustum(0, depth, is3d ? FrustumUniformType.Orthographic : FrustumUniformType.TwoDee);\r\n } else { // perspective\r\n const scale = 1.0 / (1.0 - newFraction);\r\n const zVec = Vector3d.createStartEnd(farLowerLeft, nearLowerLeft, this._scratch.vec3d);\r\n const cameraPosition = fromSumOf(farLowerLeft, zVec, scale, this._scratch.point3d);\r\n\r\n const frustumLeft = dotDifference(farLowerLeft, cameraPosition, viewX) * newFraction;\r\n const frustumRight = dotDifference(farLowerRight, cameraPosition, viewX) * newFraction;\r\n const frustumBottom = dotDifference(farLowerLeft, cameraPosition, viewY) * newFraction;\r\n const frustumTop = dotDifference(farUpperLeft, cameraPosition, viewY) * newFraction;\r\n const frustumFront = -dotDifference(nearLowerLeft, cameraPosition, viewZ);\r\n const frustumBack = -dotDifference(farLowerLeft, cameraPosition, viewZ);\r\n\r\n lookIn(cameraPosition, viewX, viewY, viewZ, this.viewMatrix);\r\n frustum(frustumLeft, frustumRight, frustumBottom, frustumTop, frustumFront, frustumBack, this.projectionMatrix);\r\n\r\n IModelFrameLifecycle.onChangeCameraView.raiseEvent({\r\n cameraPosition,\r\n viewX,\r\n viewY,\r\n viewZ,\r\n });\r\n IModelFrameLifecycle.onChangeCameraFrustum.raiseEvent({\r\n type: FrustumUniformType.Perspective,\r\n left: frustumLeft,\r\n right: frustumRight,\r\n bottom: frustumBottom,\r\n top: frustumTop,\r\n front: frustumFront,\r\n back: frustumBack,\r\n });\r\n\r\n this._nearPlaneCenter.setFrom(nearLowerLeft);\r\n this._nearPlaneCenter.interpolate(0.5, nearUpperRight, this._nearPlaneCenter);\r\n\r\n this.setPlanes(frustumTop, frustumBottom, frustumLeft, frustumRight);\r\n this.setFrustum(frustumFront, frustumBack, FrustumUniformType.Perspective);\r\n }\r\n\r\n this.viewMatrix.matrix.inverseState = InverseMatrixState.unknown;\r\n\r\n this.viewMatrix.matrix.multiplyVector(this._worldUpVector, this._viewUpVector);\r\n this._viewUpVector.normalizeInPlace();\r\n this._viewUpVector32[0] = this._viewUpVector.x;\r\n this._viewUpVector32[1] = this._viewUpVector.y;\r\n this._viewUpVector32[2] = this._viewUpVector.z;\r\n\r\n this.projectionMatrix32.initFromMatrix4d(this.projectionMatrix);\r\n }\r\n\r\n public changeProjectionMatrix(newMatrix: Matrix4d): void {\r\n desync(this);\r\n this.projectionMatrix.setFrom(newMatrix);\r\n this.projectionMatrix32.initFromMatrix4d(this.projectionMatrix);\r\n }\r\n\r\n protected setPlanes(top: number, bottom: number, left: number, right: number): void {\r\n this._planeData[Plane.kTop] = top;\r\n this._planeData[Plane.kBottom] = bottom;\r\n this._planeData[Plane.kLeft] = left;\r\n this._planeData[Plane.kRight] = right;\r\n }\r\n\r\n protected setFrustum(nearPlane: number, farPlane: number, type: FrustumUniformType): void {\r\n this._frustumData[FrustumData.kNear] = nearPlane;\r\n this._frustumData[FrustumData.kFar] = farPlane;\r\n this._frustumData[FrustumData.kType] = type as number;\r\n\r\n // If nearPlane is zero, we don't have a camera (or got very unlucky); in that case shader will compute linear depth.\r\n this._logZData[0] = 0 !== nearPlane ? 1 / nearPlane : 0;\r\n this._logZData[1] = 0 !== nearPlane ? Math.log(farPlane / nearPlane) : farPlane;\r\n }\r\n}\r\n\r\nfunction normalizedDifference(p0: Point3d, p1: Point3d, out?: Vector3d): Vector3d {\r\n const result = undefined !== out ? out : new Vector3d();\r\n result.x = p0.x - p1.x;\r\n result.y = p0.y - p1.y;\r\n result.z = p0.z - p1.z;\r\n result.normalizeInPlace();\r\n return result;\r\n}\r\n\r\n/** @internal */\r\nexport function fromSumOf(p: Point3d, v: Vector3d, scale: number, out?: Point3d) {\r\n const result = undefined !== out ? out : new Point3d();\r\n result.x = p.x + v.x * scale;\r\n result.y = p.y + v.y * scale;\r\n result.z = p.z + v.z * scale;\r\n return result;\r\n}\r\n\r\nfunction dotDifference(pt: Point3d, origin: Point3d, vec: Vector3d): number {\r\n return (pt.x - origin.x) * vec.x + (pt.y - origin.y) * vec.y + (pt.z - origin.z) * vec.z;\r\n}\r\n\r\nfunction lookIn(eye: Point3d, viewX: Vector3d, viewY: Vector3d, viewZ: Vector3d, result: Transform) {\r\n const rot = result.matrix.coffs;\r\n rot[0] = viewX.x;\r\n rot[1] = viewX.y;\r\n rot[2] = viewX.z;\r\n rot[3] = viewY.x;\r\n rot[4] = viewY.y;\r\n rot[5] = viewY.z;\r\n rot[6] = viewZ.x;\r\n rot[7] = viewZ.y;\r\n rot[8] = viewZ.z;\r\n\r\n result.origin.x = -viewX.dotProduct(eye);\r\n result.origin.y = -viewY.dotProduct(eye);\r\n result.origin.z = -viewZ.dotProduct(eye);\r\n}\r\n\r\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4d) {\r\n Matrix4d.createRowValues(\r\n 2.0 / (right - left), 0.0, 0.0, -(right + left) / (right - left),\r\n 0.0, 2.0 / (top - bottom), 0.0, -(top + bottom) / (top - bottom),\r\n 0.0, 0.0, -2.0 / (far - near), -(far + near) / (far - near),\r\n 0.0, 0.0, 0.0, 1.0,\r\n result);\r\n}\r\n\r\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4d) {\r\n Matrix4d.createRowValues(\r\n (2.0 * near) / (right - left), 0.0, (right + left) / (right - left), 0.0,\r\n 0.0, (2.0 * near) / (top - bottom), (top + bottom) / (top - bottom), 0.0,\r\n 0.0, 0.0, -(far + near) / (far - near), -(2.0 * far * near) / (far - near),\r\n 0.0, 0.0, -1.0, 0.0,\r\n result);\r\n}\r\n"]}
@@ -1,7 +1,6 @@
1
1
  /** @packageDocumentation
2
2
  * @module WebGL
3
3
  */
4
- import { ContourDisplay } from "@itwin/core-common";
5
4
  import { SceneContext } from "../../../ViewContext";
6
5
  import { ViewRect } from "../../../common/ViewRect";
7
6
  import { Pixel } from "../../../render/Pixel";
@@ -19,12 +18,6 @@ import { ShaderProgramExecutor } from "./ShaderProgram";
19
18
  import { EyeDomeLighting } from "./EDL";
20
19
  export declare function collectTextureStatistics(texture: TextureHandle | undefined, stats: RenderMemory.Statistics): void;
21
20
  export declare function collectGeometryStatistics(geom: CachedGeometry | undefined, stats: RenderMemory.Statistics): void;
22
- interface ContourPixels {
23
- display: ContourDisplay;
24
- data: Uint32Array;
25
- zLow: number;
26
- zHigh: number;
27
- }
28
21
  /** Orchestrates rendering of the scene on behalf of a Target.
29
22
  * This base class exists only so we don't have to export all the types of the shared Compositor members like Textures, FrameBuffers, etc.
30
23
  * @internal
@@ -41,7 +34,6 @@ export declare abstract class SceneCompositor implements WebGLDisposable, Render
41
34
  abstract drawForReadPixels(_commands: RenderCommands, sceneOverlays: GraphicList, worldOverlayDecorations: GraphicList | undefined, viewOverlayDecorations: GraphicList | undefined): void;
42
35
  abstract readPixels(rect: ViewRect, selector: Pixel.Selector): Pixel.Buffer | undefined;
43
36
  abstract readDepthAndOrder(rect: ViewRect): Uint8Array | undefined;
44
- abstract readContours(rect: ViewRect): ContourPixels | undefined;
45
37
  abstract readFeatureIds(rect: ViewRect): Uint8Array | undefined;
46
38
  abstract updateSolarShadows(context: SceneContext | undefined): void;
47
39
  abstract drawPrimitive(primitive: Primitive, exec: ShaderProgramExecutor, outputsToPick: boolean): void;
@@ -56,5 +48,4 @@ export declare abstract class SceneCompositor implements WebGLDisposable, Render
56
48
  static create(target: Target): SceneCompositor;
57
49
  abstract collectStatistics(stats: RenderMemory.Statistics): void;
58
50
  }
59
- export {};
60
51
  //# sourceMappingURL=SceneCompositor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SceneCompositor.d.ts","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/SceneCompositor.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EACH,cAAc,EAEjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAC2D,cAAc,EAE/E,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAW,eAAe,EAAE,MAAM,OAAO,CAAC;AAGjD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,UAAU,GAAG,IAAI,CAGjH;AA+dD,wBAAg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iBAAiB,IAAI,IAAI;IAEzC,8GAA8G;IAC9G,aAAoB,oBAAoB,IAAI,WAAW,CAAC;IAExD,aAAoB,UAAU,IAAI,aAAa,CAAC;IAChD,aAAoB,aAAa,IAAI,aAAa,CAAC;IACnD,aAAoB,gBAAgB,IAAI,MAAM,CAAC;IAE/C,IAAW,eAAe,IAAI,OAAO,CAAkC;IAEvE,SAAS,aAAa,MAAM,EAAE,MAAM;WAOtB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;aAIrC,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,UAAU,GAAG,IAAI;CACxE"}
@@ -47,8 +47,6 @@ class Textures {
47
47
  featureId;
48
48
  depthAndOrder;
49
49
  depthAndOrderHidden; // only used if AO and multisampling
50
- contours;
51
- contoursMsBuff;
52
50
  hilite;
53
51
  occlusion;
54
52
  occlusionBlur;
@@ -66,8 +64,6 @@ class Textures {
66
64
  && undefined === this.color
67
65
  && undefined === this.featureId
68
66
  && undefined === this.depthAndOrder
69
- && undefined === this.contours
70
- && undefined === this.contoursMsBuff
71
67
  && undefined === this.depthAndOrderHidden
72
68
  && undefined === this.hilite
73
69
  && undefined === this.occlusion
@@ -87,8 +83,6 @@ class Textures {
87
83
  this.color = (0, core_bentley_1.dispose)(this.color);
88
84
  this.featureId = (0, core_bentley_1.dispose)(this.featureId);
89
85
  this.depthAndOrder = (0, core_bentley_1.dispose)(this.depthAndOrder);
90
- this.contours = (0, core_bentley_1.dispose)(this.contours);
91
- this.contoursMsBuff = (0, core_bentley_1.dispose)(this.contoursMsBuff);
92
86
  this.depthAndOrderHidden = (0, core_bentley_1.dispose)(this.depthAndOrderHidden);
93
87
  this.hilite = (0, core_bentley_1.dispose)(this.hilite);
94
88
  this.occlusion = (0, core_bentley_1.dispose)(this.occlusion);
@@ -108,8 +102,6 @@ class Textures {
108
102
  collectTextureStatistics(this.color, stats);
109
103
  collectTextureStatistics(this.featureId, stats);
110
104
  collectTextureStatistics(this.depthAndOrder, stats);
111
- collectTextureStatistics(this.contours, stats);
112
- collectMsBufferStatistics(this.contoursMsBuff, stats);
113
105
  collectTextureStatistics(this.depthAndOrderHidden, stats);
114
106
  collectTextureStatistics(this.hilite, stats);
115
107
  collectTextureStatistics(this.occlusion, stats);
@@ -148,13 +140,11 @@ class Textures {
148
140
  this.color = Texture_1.TextureHandle.createForAttachment(width, height, GL_1.GL.Texture.Format.Rgba, GL_1.GL.Texture.DataType.UnsignedByte);
149
141
  this.featureId = Texture_1.TextureHandle.createForAttachment(width, height, GL_1.GL.Texture.Format.Rgba, GL_1.GL.Texture.DataType.UnsignedByte);
150
142
  this.depthAndOrder = Texture_1.TextureHandle.createForAttachment(width, height, GL_1.GL.Texture.Format.Rgba, GL_1.GL.Texture.DataType.UnsignedByte);
151
- this.contours = Texture_1.TextureHandle.createForAttachment(width, height, GL_1.GL.Texture.Format.Rgba, GL_1.GL.Texture.DataType.UnsignedByte);
152
143
  let rVal = undefined !== this.accumulation
153
144
  && undefined !== this.revealage
154
145
  && undefined !== this.color
155
146
  && undefined !== this.featureId
156
147
  && undefined !== this.depthAndOrder
157
- && undefined !== this.contours
158
148
  && undefined !== this.hilite;
159
149
  if (rVal && numSamples > 1) {
160
150
  rVal = this.enableMultiSampling(width, height, numSamples);
@@ -199,14 +189,12 @@ class Textures {
199
189
  this.featureIdMsBuffHidden = RenderBuffer_1.RenderBufferMultiSample.create(width, height, WebGL2RenderingContext.RGBA8, numSamples);
200
190
  this.depthAndOrderMsBuff = RenderBuffer_1.RenderBufferMultiSample.create(width, height, WebGL2RenderingContext.RGBA8, numSamples);
201
191
  this.depthAndOrderMsBuffHidden = RenderBuffer_1.RenderBufferMultiSample.create(width, height, WebGL2RenderingContext.RGBA8, numSamples);
202
- this.contoursMsBuff = RenderBuffer_1.RenderBufferMultiSample.create(width, height, WebGL2RenderingContext.RGBA8, numSamples);
203
192
  this.hiliteMsBuff = RenderBuffer_1.RenderBufferMultiSample.create(width, height, WebGL2RenderingContext.RGBA8, numSamples);
204
193
  return undefined !== this.colorMsBuff
205
194
  && undefined !== this.featureIdMsBuff
206
195
  && undefined !== this.featureIdMsBuffHidden
207
196
  && undefined !== this.depthAndOrderMsBuff
208
197
  && undefined !== this.depthAndOrderMsBuffHidden
209
- && undefined !== this.contoursMsBuff
210
198
  && undefined !== this.hiliteMsBuff;
211
199
  }
212
200
  disableMultiSampling() {
@@ -215,7 +203,6 @@ class Textures {
215
203
  this.featureIdMsBuffHidden = (0, core_bentley_1.dispose)(this.featureIdMsBuffHidden);
216
204
  this.depthAndOrderMsBuff = (0, core_bentley_1.dispose)(this.depthAndOrderMsBuff);
217
205
  this.depthAndOrderMsBuffHidden = (0, core_bentley_1.dispose)(this.depthAndOrderMsBuffHidden);
218
- this.contoursMsBuff = (0, core_bentley_1.dispose)(this.contoursMsBuff);
219
206
  this.hiliteMsBuff = (0, core_bentley_1.dispose)(this.hiliteMsBuff);
220
207
  return true;
221
208
  }
@@ -225,7 +212,6 @@ class FrameBuffers {
225
212
  opaqueColor;
226
213
  opaqueAndCompositeColor;
227
214
  depthAndOrder;
228
- contours;
229
215
  hilite;
230
216
  hiliteUsingStencil;
231
217
  stencilSet;
@@ -250,10 +236,9 @@ class FrameBuffers {
250
236
  if (!this.initPotentialMSFbos(textures, depth, depthMS))
251
237
  return false;
252
238
  this.depthAndOrder = FrameBuffer_1.FrameBuffer.create([(0, core_bentley_1.expectDefined)(textures.depthAndOrder)], depth);
253
- this.contours = FrameBuffer_1.FrameBuffer.create([(0, core_bentley_1.expectDefined)(textures.contours)], depth);
254
239
  this.hilite = FrameBuffer_1.FrameBuffer.create([(0, core_bentley_1.expectDefined)(textures.hilite)], depth);
255
240
  this.hiliteUsingStencil = FrameBuffer_1.FrameBuffer.create([(0, core_bentley_1.expectDefined)(textures.hilite)], depth);
256
- if (!this.depthAndOrder || !this.contours || !this.hilite || !this.hiliteUsingStencil)
241
+ if (!this.depthAndOrder || !this.hilite || !this.hiliteUsingStencil)
257
242
  return false;
258
243
  (0, core_bentley_1.assert)(undefined === this.opaqueAll);
259
244
  if (!this.initPotentialMSMRTFbos(textures, depth, depthMS))
@@ -294,10 +279,9 @@ class FrameBuffers {
294
279
  undefined !== textures.color &&
295
280
  undefined !== textures.featureId &&
296
281
  undefined !== textures.depthAndOrder &&
297
- undefined !== textures.contours &&
298
282
  undefined !== textures.accumulation &&
299
283
  undefined !== textures.revealage);
300
- const colorAndPick = [boundColor, textures.featureId, textures.depthAndOrder, textures.contours];
284
+ const colorAndPick = [boundColor, textures.featureId, textures.depthAndOrder];
301
285
  if (undefined === depthMs) {
302
286
  this.opaqueAll = FrameBuffer_1.FrameBuffer.create(colorAndPick, depth);
303
287
  colorAndPick[0] = textures.color;
@@ -307,10 +291,9 @@ class FrameBuffers {
307
291
  (0, core_bentley_1.assert)(undefined !== textures.colorMsBuff &&
308
292
  undefined !== textures.featureIdMsBuff &&
309
293
  undefined !== textures.featureIdMsBuffHidden &&
310
- undefined !== textures.contoursMsBuff &&
311
294
  undefined !== textures.depthAndOrderMsBuff &&
312
295
  undefined !== textures.depthAndOrderMsBuffHidden);
313
- const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff, textures.contoursMsBuff];
296
+ const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff];
314
297
  const colorAndPickFilters = [GL_1.GL.MultiSampling.Filter.Linear, GL_1.GL.MultiSampling.Filter.Nearest, GL_1.GL.MultiSampling.Filter.Nearest, GL_1.GL.MultiSampling.Filter.Nearest];
315
298
  this.opaqueAll = FrameBuffer_1.FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
316
299
  colorAndPick[0] = textures.color;
@@ -426,7 +409,7 @@ class FrameBuffers {
426
409
  return this.initPotentialMSFbos(textures, depth, undefined);
427
410
  }
428
411
  get isDisposed() {
429
- return undefined === this.opaqueColor && undefined === this.opaqueAndCompositeColor && undefined === this.depthAndOrder && undefined === this.contours
412
+ return undefined === this.opaqueColor && undefined === this.opaqueAndCompositeColor && undefined === this.depthAndOrder
430
413
  && undefined === this.hilite && undefined === this.hiliteUsingStencil && undefined === this.occlusion
431
414
  && undefined === this.occlusionBlur && undefined === this.stencilSet && undefined === this.altZOnly
432
415
  && undefined === this.volClassCreateBlend && undefined === this.volClassCreateBlendAltZ && undefined === this.opaqueAll
@@ -439,7 +422,6 @@ class FrameBuffers {
439
422
  this.opaqueColor = (0, core_bentley_1.dispose)(this.opaqueColor);
440
423
  this.opaqueAndCompositeColor = (0, core_bentley_1.dispose)(this.opaqueAndCompositeColor);
441
424
  this.depthAndOrder = (0, core_bentley_1.dispose)(this.depthAndOrder);
442
- this.contours = (0, core_bentley_1.dispose)(this.contours);
443
425
  this.hilite = (0, core_bentley_1.dispose)(this.hilite);
444
426
  this.hiliteUsingStencil = (0, core_bentley_1.dispose)(this.hiliteUsingStencil);
445
427
  this.occlusion = (0, core_bentley_1.dispose)(this.occlusion);
@@ -556,7 +538,6 @@ class PixelBuffer {
556
538
  _selector;
557
539
  _featureId;
558
540
  _depthAndOrder;
559
- _contours;
560
541
  _batchState;
561
542
  _scratchModelFeature = core_common_1.ModelFeature.create();
562
543
  get _numPixels() { return this._rect.width * this._rect.height; }
@@ -670,28 +651,6 @@ class PixelBuffer {
670
651
  }
671
652
  }
672
653
  }
673
- let contour;
674
- if (this._contours) {
675
- const contour32 = this.getPixel32(this._contours.data, index);
676
- if (contour32) { // undefined means out of bounds; zero means not a contour.
677
- const groupIndexAndType = this.decodeUint8(contour32, 32);
678
- const groupIndex = groupIndexAndType & ~(8 | 16);
679
- const group = this._contours.display.groups[groupIndex];
680
- if (group) {
681
- const elevationFraction = this.decodeDepthRgba(contour32);
682
- let elevation = elevationFraction * (this._contours.zHigh - this._contours.zLow) + this._contours.zLow;
683
- // The shader rounds to the nearest contour elevation using single-precision arithmetic.
684
- // Re-round here using double-precision to get closer.
685
- const interval = group.contourDef.minorInterval;
686
- elevation = (elevation >= 0 ? Math.floor((elevation + interval / 2) / interval) : Math.ceil((elevation - interval / 2) / interval)) * interval;
687
- contour = {
688
- group,
689
- elevation,
690
- isMajor: groupIndexAndType > 15,
691
- };
692
- }
693
- }
694
- }
695
654
  let featureTable, iModel, transformToIModel, tileId, viewAttachmentId, inSectionDrawingAttachment;
696
655
  if (undefined !== batchInfo) {
697
656
  featureTable = batchInfo.featureTable;
@@ -712,7 +671,6 @@ class PixelBuffer {
712
671
  tileId,
713
672
  viewAttachmentId,
714
673
  inSectionDrawingAttachment,
715
- contour,
716
674
  });
717
675
  }
718
676
  constructor(rect, selector, compositor) {
@@ -733,10 +691,6 @@ class PixelBuffer {
733
691
  else
734
692
  this._selector &= ~Pixel_1.Pixel.Selector.Feature;
735
693
  }
736
- // Note: readContours is a no-op unless contours are actually being drawn.
737
- if (Pixel_1.Pixel.Selector.None !== (selector & Pixel_1.Pixel.Selector.Contours)) {
738
- this._contours = compositor.readContours(rect);
739
- }
740
694
  }
741
695
  get isEmpty() { return Pixel_1.Pixel.Selector.None === this._selector; }
742
696
  static create(rect, selector, compositor) {
@@ -1424,23 +1378,6 @@ class Compositor extends SceneCompositor {
1424
1378
  readDepthAndOrder(rect) {
1425
1379
  return this.readFrameBuffer(rect, this._fbos.depthAndOrder);
1426
1380
  }
1427
- readContours(rect) {
1428
- // Are we actually drawing any contours? If not, don't bother reading an array of all zeroes off the GPU.
1429
- const contours = this.target.currentContours;
1430
- if (!contours || !contours.displayContours || contours.groups.length === 0) {
1431
- return undefined;
1432
- }
1433
- const info = this.readFrameBuffer(rect, this._fbos.contours);
1434
- if (!info) {
1435
- return undefined;
1436
- }
1437
- return {
1438
- data: new Uint32Array(info.buffer),
1439
- display: contours,
1440
- zLow: this.target.uniforms.frustum.worldFrustumZRange[0],
1441
- zHigh: this.target.uniforms.frustum.worldFrustumZRange[1],
1442
- };
1443
- }
1444
1381
  readFeatureIds(rect) {
1445
1382
  const tex = this._textures.featureId;
1446
1383
  if (undefined === tex)