@itwin/core-frontend 5.1.4 → 5.1.6
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.
- package/CHANGELOG.md +15 -1
- package/lib/cjs/PlanarClipMaskState.d.ts +3 -0
- package/lib/cjs/PlanarClipMaskState.d.ts.map +1 -1
- package/lib/cjs/PlanarClipMaskState.js +5 -1
- package/lib/cjs/PlanarClipMaskState.js.map +1 -1
- package/lib/cjs/ViewContext.d.ts +10 -1
- package/lib/cjs/ViewContext.d.ts.map +1 -1
- package/lib/cjs/ViewContext.js +12 -1
- package/lib/cjs/ViewContext.js.map +1 -1
- package/lib/cjs/internal/render/webgl/BatchUniforms.d.ts +4 -1
- package/lib/cjs/internal/render/webgl/BatchUniforms.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/BatchUniforms.js +15 -4
- package/lib/cjs/internal/render/webgl/BatchUniforms.js.map +1 -1
- package/lib/cjs/internal/render/webgl/FeatureOverrides.d.ts +3 -3
- package/lib/cjs/internal/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/FeatureOverrides.js +10 -10
- package/lib/cjs/internal/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/internal/render/webgl/Graphic.d.ts +3 -3
- package/lib/cjs/internal/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/Graphic.js +7 -7
- package/lib/cjs/internal/render/webgl/Graphic.js.map +1 -1
- package/lib/cjs/internal/render/webgl/PlanarClassifier.d.ts +1 -0
- package/lib/cjs/internal/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/PlanarClassifier.js +19 -3
- package/lib/cjs/internal/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.d.ts +2 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.js +3 -1
- package/lib/cjs/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/cjs/internal/render/webgl/Target.js +2 -2
- package/lib/cjs/internal/render/webgl/Target.js.map +1 -1
- package/lib/cjs/internal/render/webgl/VisibleTileFeatures.js +1 -1
- package/lib/cjs/internal/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/lib/esm/PlanarClipMaskState.d.ts +3 -0
- package/lib/esm/PlanarClipMaskState.d.ts.map +1 -1
- package/lib/esm/PlanarClipMaskState.js +5 -1
- package/lib/esm/PlanarClipMaskState.js.map +1 -1
- package/lib/esm/ViewContext.d.ts +10 -1
- package/lib/esm/ViewContext.d.ts.map +1 -1
- package/lib/esm/ViewContext.js +12 -1
- package/lib/esm/ViewContext.js.map +1 -1
- package/lib/esm/internal/render/webgl/BatchUniforms.d.ts +4 -1
- package/lib/esm/internal/render/webgl/BatchUniforms.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/BatchUniforms.js +15 -4
- package/lib/esm/internal/render/webgl/BatchUniforms.js.map +1 -1
- package/lib/esm/internal/render/webgl/FeatureOverrides.d.ts +3 -3
- package/lib/esm/internal/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/FeatureOverrides.js +10 -10
- package/lib/esm/internal/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/internal/render/webgl/Graphic.d.ts +3 -3
- package/lib/esm/internal/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/Graphic.js +7 -7
- package/lib/esm/internal/render/webgl/Graphic.js.map +1 -1
- package/lib/esm/internal/render/webgl/PlanarClassifier.d.ts +1 -0
- package/lib/esm/internal/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/PlanarClassifier.js +19 -3
- package/lib/esm/internal/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/internal/render/webgl/RenderCommands.d.ts +2 -1
- package/lib/esm/internal/render/webgl/RenderCommands.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/RenderCommands.js +3 -1
- package/lib/esm/internal/render/webgl/RenderCommands.js.map +1 -1
- package/lib/esm/internal/render/webgl/Target.js +2 -2
- package/lib/esm/internal/render/webgl/Target.js.map +1 -1
- package/lib/esm/internal/render/webgl/VisibleTileFeatures.js +1 -1
- package/lib/esm/internal/render/webgl/VisibleTileFeatures.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanarClassifier.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/PlanarClassifier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,QAAQ,EAAW,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,mBAAmB,GAClJ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE1G,OAAO,EAAE,yBAAyB,EAAyD,MAAM,wBAAwB,CAAC;AAK1H,OAAO,EAA0B,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAkB,wBAAwB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG3H,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,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C,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { BeEvent, dispose } from \"@itwin/core-bentley\";\nimport {\n ColorDef, Frustum, FrustumPlanes, RenderMode, RenderTexture, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, TextureTransparency,\n} from \"@itwin/core-common\";\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Range3d, Vector3d } from \"@itwin/core-geometry\";\nimport { PlanarClipMaskState } from \"../../../PlanarClipMaskState\";\nimport { GraphicsCollectorDrawArgs, SpatialClassifierTileTreeReference, TileTreeReference } from \"../../../tile/internal\";\nimport { SceneContext } from \"../../../ViewContext\";\nimport { FeatureSymbology } from \"../../../render/FeatureSymbology\";\nimport { RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { RenderMemory } from \"../../../render/RenderMemory\";\nimport { PlanarClassifierTarget, RenderPlanarClassifier } from \"../RenderPlanarClassifier\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { CachedGeometry, Combine3TexturesGeometry, CombineTexturesGeometry, ViewportQuadGeometry } from \"./CachedGeometry\";\nimport { WebGLDisposable } from \"./Disposable\";\nimport { DrawCommands } from \"./DrawCommand\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { Batch, Branch } from \"./Graphic\";\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass } from \"./RenderFlags\";\nimport { RenderState } from \"./RenderState\";\nimport { getDrawParams } from \"./ScratchDrawParams\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { TechniqueId } from \"./TechniqueId\";\nimport { Texture, TextureHandle } from \"./Texture\";\nimport { ActiveSpatialClassifier } from \"../../../SpatialClassifiersState\";\n\nexport enum PlanarClassifierContent { None = 0, MaskOnly = 1, ClassifierOnly = 2, ClassifierAndMask = 3 }\n\nfunction createTexture(handle: TextureHandle): Texture {\n return new Texture({\n handle,\n ownership: \"external\",\n type: RenderTexture.Type.TileSection,\n transparency: TextureTransparency.Opaque,\n });\n}\n\nfunction createTextureHandle(width: number, height: number, heightMult = 1.0) {\n return TextureHandle.createForAttachment(width, height * heightMult, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n}\n\nclass ClassifierTextures implements WebGLDisposable {\n private constructor(public readonly color: Texture,\n public readonly feature: Texture,\n public readonly hilite: Texture) { }\n\n public get isDisposed(): boolean {\n return this.color.isDisposed\n && this.feature.isDisposed\n && this.hilite.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this.color);\n dispose(this.feature);\n dispose(this.hilite);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n stats.addPlanarClassifier(this.color.bytesUsed);\n stats.addPlanarClassifier(this.feature.bytesUsed);\n stats.addPlanarClassifier(this.hilite.bytesUsed);\n }\n\n public static create(width: number, height: number): ClassifierTextures | undefined {\n const hColor = createTextureHandle(width, height);\n const hFeature = createTextureHandle(width, height);\n const hHilite = createTextureHandle(width, height);\n if (!hColor || !hFeature || !hHilite)\n return undefined;\n\n const color = createTexture(hColor);\n const feature = createTexture(hFeature);\n const hilite = createTexture(hHilite);\n if (!color || !feature || !hilite)\n return undefined;\n\n return new ClassifierTextures(color, feature, hilite);\n }\n}\n\nclass ClassifierFrameBuffers implements WebGLDisposable {\n private constructor(\n public readonly textures: ClassifierTextures,\n private readonly _hilite: FrameBuffer,\n private readonly _fbo: FrameBuffer,\n private readonly _clearGeom: ViewportQuadGeometry) {\n }\n\n public get isDisposed(): boolean {\n return this.textures.isDisposed && this._hilite.isDisposed && this._fbo.isDisposed && this._clearGeom.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this._fbo);\n dispose(this._clearGeom);\n dispose(this.textures);\n dispose(this._hilite);\n }\n\n public draw(cmds: DrawCommands, target: Target): void {\n System.instance.frameBufferStack.execute(this._fbo, true, false, () => {\n target.techniques.draw(getDrawParams(target, this._clearGeom));\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\n });\n }\n\n public drawHilite(cmds: DrawCommands, target: Target): void {\n const system = System.instance;\n const gl = system.context;\n system.frameBufferStack.execute(this._hilite, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.execute(target, cmds, RenderPass.Hilite);\n });\n }\n\n public static create(width: number, height: number): ClassifierFrameBuffers | undefined {\n const textures = ClassifierTextures.create(width, height);\n if (undefined === textures)\n return undefined;\n\n const hiliteFbo = FrameBuffer.create([textures.hilite.texture]);\n if (undefined === hiliteFbo)\n return undefined;\n\n const fbo = FrameBuffer.create([textures.color.texture, textures.feature.texture]);\n if (undefined === fbo)\n return undefined;\n\n const geom = ViewportQuadGeometry.create(TechniqueId.ClearPickAndColor);\n return undefined !== geom ? new this(textures, hiliteFbo, fbo, geom) : undefined;\n }\n}\n\ninterface TextureAndFbo {\n texture: Texture;\n fbo: FrameBuffer;\n}\n\nabstract class SingleTextureFrameBuffer implements WebGLDisposable {\n public texture: Texture;\n protected fbo: FrameBuffer;\n public get isDisposed(): boolean { return this.texture.isDisposed && this.fbo.isDisposed; }\n public collectStatistics(stats: RenderMemory.Statistics): void { stats.addPlanarClassifier(this.texture.bytesUsed); }\n protected constructor(textureAndFbo: TextureAndFbo) {\n this.texture = textureAndFbo.texture;\n this.fbo = textureAndFbo.fbo;\n }\n public [Symbol.dispose](): void {\n dispose(this.texture);\n dispose(this.fbo);\n }\n public static createTextureAndFrameBuffer(width: number, height: number): TextureAndFbo | undefined {\n const hTexture = TextureHandle.createForAttachment(width, height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n if (!hTexture)\n return undefined;\n\n const texture = new Texture({ type: RenderTexture.Type.TileSection, ownership: \"external\", handle: hTexture, transparency: TextureTransparency.Opaque });\n if (!texture)\n return undefined;\n\n const fbo = FrameBuffer.create([texture.texture]);\n if (undefined === fbo)\n return undefined;\n\n return { texture, fbo };\n }\n}\nclass MaskFrameBuffer extends SingleTextureFrameBuffer {\n public static create(width: number, height: number): MaskFrameBuffer | undefined {\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, height);\n return undefined === textureFbo ? undefined : new MaskFrameBuffer(textureFbo);\n }\n public draw(cmds: DrawCommands, target: Target): void {\n const system = System.instance;\n const gl = system.context;\n\n system.frameBufferStack.execute(this.fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\n });\n }\n}\nabstract class CombineTexturesFrameBuffer extends SingleTextureFrameBuffer {\n constructor(textureAndFbo: TextureAndFbo, private _combineGeom: CachedGeometry, private _width: number, private _height: number, private _heightMult: number) { super(textureAndFbo); }\n public compose(target: Target): void {\n const system = System.instance;\n const gl = system.context;\n system.context.viewport(0, 0, this._width, this._heightMult * this._height);\n system.frameBufferStack.execute(this.fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.draw(getDrawParams(target, this._combineGeom));\n });\n }\n}\n\nclass ClassifierCombinationBuffer extends CombineTexturesFrameBuffer {\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture): ClassifierAndMaskCombinationBuffer | undefined {\n const combineGeom = CombineTexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!);\n if (undefined === combineGeom)\n return undefined;\n\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 2 * height);\n return undefined === textureFbo ? undefined : new ClassifierCombinationBuffer(textureFbo, combineGeom, width, height, 2);\n }\n}\nclass ClassifierAndMaskCombinationBuffer extends CombineTexturesFrameBuffer {\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture, mask: Texture): ClassifierAndMaskCombinationBuffer | undefined {\n const combineGeom = Combine3TexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!, mask.texture.getHandle()!);\n if (undefined === combineGeom)\n return undefined;\n\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 3 * height);\n return undefined === textureFbo ? undefined : new ClassifierAndMaskCombinationBuffer(textureFbo, combineGeom, width, height, 3);\n }\n}\n\nconst scratchPrevRenderState = new RenderState();\n\n/** @internal */\nexport class PlanarClassifier extends RenderPlanarClassifier implements RenderMemory.Consumer, WebGLDisposable {\n private _classifierBuffers?: ClassifierFrameBuffers;\n private _maskBuffer?: MaskFrameBuffer;\n private _classifierCombinedBuffer?: ClassifierCombinationBuffer;\n private _classifierAndMaskCombinedBuffer?: ClassifierAndMaskCombinationBuffer;\n private _projectionMatrix = Matrix4d.createIdentity();\n private _graphics?: RenderGraphic[];\n private readonly _classifierGraphics: RenderGraphic[] = [];\n private readonly _maskGraphics: RenderGraphic[] = [];\n private _frustum?: Frustum;\n private _width = 0;\n private _height = 0;\n private _baseBatchId = 0;\n private _anyHilited = false;\n private _anyOpaque = false;\n private _anyTranslucent = false;\n private _classifier?: ActiveSpatialClassifier;\n private readonly _plane = Plane3dByOriginAndUnitNormal.create(new Point3d(0, 0, 0), new Vector3d(0, 0, 1))!; // TBD -- Support other planes - default to X-Y for now.\n private readonly _renderState = new RenderState();\n private readonly _renderCommands: RenderCommands;\n private readonly _branchStack = new BranchStack();\n private readonly _batchState: BatchState;\n private _planarClipMask?: PlanarClipMaskState;\n private _classifierTreeRef?: SpatialClassifierTileTreeReference;\n private _planarClipMaskOverrides?: FeatureSymbology.Overrides;\n private _contentMode: PlanarClassifierContent = PlanarClassifierContent.None;\n private _removeMe?: () => void;\n private _featureSymbologySource: FeatureSymbology.Source = {\n onSourceDisposed: new BeEvent<() => void>(),\n };;\n\n private static _postProjectionMatrix = Matrix4d.createRowValues(\n 0, 1, 0, 0,\n 0, 0, -1, 0,\n 1, 0, 0, 0,\n 0, 0, 0, 1);\n private _debugFrustum?: Frustum;\n private _doDebugFrustum = false;\n private _debugFrustumGraphic?: RenderGraphic = undefined;\n private _isClassifyingPointCloud?: boolean; // we will detect this the first time we draw\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\n\n private constructor(classifier: ActiveSpatialClassifier | undefined, target: Target) {\n super();\n this._classifier = classifier;\n\n const flags = this._renderState.flags;\n flags.depthMask = flags.blend = flags.depthTest = false;\n\n this._batchState = new BatchState(this._branchStack);\n this._renderCommands = new RenderCommands(target, this._branchStack, this._batchState);\n }\n public get textureImageCount(): number { return this._contentMode; }\n\n public getParams(params: Float32Array): void {\n params[0] = this.insideDisplay;\n params[1] = this.outsideDisplay;\n params[2] = this._contentMode;\n if (this._planarClipMask?.settings.invert) // If the mask sense is inverted, negate the contentMode to indicate this to the shader.\n params[2] = - params[2];\n\n params[3] = (this._planarClipMask?.settings.transparency === undefined) ? -1 : this._planarClipMask.settings.transparency;\n\n }\n\n public get hiliteTexture(): Texture | undefined { return undefined !== this._classifierBuffers ? this._classifierBuffers.textures.hilite : undefined; }\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\n // public get properties(): SpatialClassifier { return this._classifier; }\n public get baseBatchId(): number { return this._baseBatchId; }\n public get anyHilited(): boolean { return this._anyHilited; }\n public get anyOpaque(): boolean { return this._anyOpaque; }\n public get anyTranslucent(): boolean { return this._anyTranslucent; }\n public get insideDisplay(): SpatialClassifierInsideDisplay { return this._classifier ? this._classifier.flags.inside : SpatialClassifierInsideDisplay.Off; }\n public get outsideDisplay(): SpatialClassifierOutsideDisplay { return this._classifier ? this._classifier.flags.outside : SpatialClassifierOutsideDisplay.On; }\n public get isClassifyingPointCloud(): boolean { return true === this._isClassifyingPointCloud; }\n\n public addGraphic(graphic: RenderGraphic) {\n this._graphics!.push(graphic);\n }\n\n public static create(properties: ActiveSpatialClassifier | undefined, target: Target): PlanarClassifier {\n return new PlanarClassifier(properties, target);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n if (undefined !== this._classifierBuffers)\n this._classifierBuffers.textures.collectStatistics(stats);\n\n if (undefined !== this._maskBuffer)\n this._maskBuffer.collectStatistics(stats);\n\n if (undefined !== this._classifierCombinedBuffer)\n this._classifierCombinedBuffer.collectStatistics(stats);\n\n if (undefined !== this._classifierAndMaskCombinedBuffer)\n this._classifierAndMaskCombinedBuffer.collectStatistics(stats);\n }\n\n public get isDisposed(): boolean { return undefined === this._classifierBuffers; }\n\n public [Symbol.dispose]() {\n this._classifierBuffers = dispose(this._classifierBuffers);\n this._maskBuffer = dispose(this._maskBuffer);\n this._classifierCombinedBuffer = dispose(this._classifierCombinedBuffer);\n this._classifierAndMaskCombinedBuffer = dispose(this._classifierAndMaskCombinedBuffer);\n if (this._removeMe) {\n this._removeMe();\n this._removeMe = undefined;\n }\n this._featureSymbologySource.onSourceDisposed.raiseEvent();\n }\n\n public get texture(): Texture | undefined {\n switch (this._contentMode) {\n case PlanarClassifierContent.None:\n return undefined;\n case PlanarClassifierContent.ClassifierOnly:\n return this._classifierCombinedBuffer?.texture;\n case PlanarClassifierContent.MaskOnly:\n return this._maskBuffer?.texture;\n case PlanarClassifierContent.ClassifierAndMask:\n return this._classifierAndMaskCombinedBuffer?.texture;\n }\n }\n public getOrCreateClassifierTexture(): Texture | undefined {\n if (undefined === this._classifierBuffers)\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\n if (undefined !== this._classifierBuffers && undefined === this._classifierCombinedBuffer)\n this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\n\n return this._classifierCombinedBuffer?.texture;\n }\n\n private pushBatches(batchState: BatchState, graphics: RenderGraphic[]) {\n graphics.forEach((graphic) => {\n if (graphic instanceof Batch) {\n batchState.push(graphic, true);\n batchState.pop();\n } else if (graphic instanceof Branch) {\n this.pushBatches(batchState, graphic.branch.entries);\n }\n });\n }\n public get sourceTransparency() {\n return this._classifierTreeRef?.transparency;\n }\n\n public pushBatchState(batchState: BatchState) {\n this._baseBatchId = batchState.nextBatchId - 1;\n if (undefined !== this._classifierGraphics)\n this.pushBatches(batchState, this._classifierGraphics);\n }\n\n public setSource(classifierTreeRef?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState) {\n this._classifierTreeRef = classifierTreeRef;\n this._classifier = classifierTreeRef?.activeClassifier;\n this._planarClipMask = planarClipMask;\n }\n\n public collectGraphics(context: SceneContext, target: PlanarClassifierTarget): void {\n this._classifierGraphics.length = this._maskGraphics.length = 0;\n if (undefined === context.viewingSpace)\n return;\n\n const viewState = context.viewingSpace.view;\n if (!viewState.isSpatialView())\n return;\n\n this._doDebugFrustum = context.target.debugControl?.displayMaskFrustum ?? false;\n\n const maxTextureSize = System.instance.maxTexSizeAllow;\n const requiredHeight = maxTextureSize;\n const requiredWidth = maxTextureSize;\n if (requiredWidth !== this._width || requiredHeight !== this._height)\n this[Symbol.dispose]();\n\n this._width = requiredWidth;\n this._height = requiredHeight;\n const maskRange = Range3d.createNull();\n const maskTrees = this._planarClipMask?.getTileTrees(context, target.modelId, maskRange);\n if (!maskTrees && !this._classifierTreeRef)\n return;\n\n const allTrees = maskTrees ? maskTrees.slice() : new Array<TileTreeReference>();\n if (this._classifierTreeRef)\n allTrees.push(this._classifierTreeRef);\n\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, target, allTrees, viewState, this._width, this._height, maskRange);\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\n return;\n\n this._projectionMatrix = projection.projectionMatrix;\n this._frustum = projection.textureFrustum;\n this._debugFrustum = projection.debugFrustum;\n this._planarClipMaskOverrides = this._planarClipMask?.getPlanarClipMaskSymbologyOverrides(context, this._featureSymbologySource);\n if (!this._planarClipMask?.usingViewportOverrides && this._removeMe) {\n this._removeMe();\n this._removeMe = undefined;\n } else if (this._planarClipMask?.usingViewportOverrides && !this._removeMe) {\n this._removeMe = context.viewport.onFeatureOverridesChanged.addListener(() => {\n this._planarClipMaskOverrides = this._planarClipMask?.getPlanarClipMaskSymbologyOverrides(context, this._featureSymbologySource);\n context.viewport.requestRedraw();\n });\n }\n\n const drawTree = (treeRef: TileTreeReference, graphics: RenderGraphic[]) => {\n this._graphics = graphics;\n const frustumPlanes = this._frustum ? FrustumPlanes.fromFrustum(this._frustum) : FrustumPlanes.createEmpty();\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, treeRef, frustumPlanes, projection.worldToViewMap!);\n if (undefined !== drawArgs)\n treeRef.draw(drawArgs);\n\n this._graphics = undefined;\n };\n if (this._classifierTreeRef)\n drawTree(this._classifierTreeRef, this._classifierGraphics);\n\n if (maskTrees)\n maskTrees.forEach((maskTree) => drawTree(maskTree, this._maskGraphics));\n\n // Shader behaves slightly differently when classifying surfaces vs point clouds.\n this._isClassifyingPointCloud = target.isPointCloud;\n\n if (this._doDebugFrustum) {\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\n const builder = context.createSceneGraphicBuilder();\n\n builder.setSymbology(ColorDef.green, ColorDef.green, 2);\n builder.addFrustum(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addFrustum(this._debugFrustum!);\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\n builder.addFrustum(this._frustum);\n\n builder.setSymbology(ColorDef.from(0, 200, 0, 222), ColorDef.from(0, 200, 0, 222), 2);\n builder.addFrustumSides(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.from(200, 0, 0, 222), ColorDef.from(200, 0, 0, 222), 2);\n builder.addFrustumSides(this._debugFrustum!);\n builder.setSymbology(ColorDef.from(0, 0, 200, 222), ColorDef.from(0, 0, 200, 222), 2);\n builder.addFrustumSides(this._frustum);\n this._debugFrustumGraphic = builder.finish();\n context.outputGraphic(this._debugFrustumGraphic);\n }\n }\n\n public draw(target: Target) {\n if (undefined === this._frustum)\n return;\n\n this._contentMode = PlanarClassifierContent.None;\n let combinationBuffer: ClassifierCombinationBuffer | undefined;\n if (this._classifierGraphics.length === 0) {\n if (this._maskGraphics.length === 0) {\n return;\n } else {\n if (undefined === this._maskBuffer) {\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\n if (undefined === this._maskBuffer)\n return;\n }\n this._contentMode = PlanarClassifierContent.MaskOnly;\n }\n } else {\n if (undefined === this._classifierBuffers) {\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\n if (undefined === this._classifierBuffers)\n return;\n }\n if (this._maskGraphics.length === 0) {\n if (undefined === this._classifierCombinedBuffer) {\n combinationBuffer = this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\n if (undefined === this._classifierCombinedBuffer)\n return;\n }\n this._contentMode = PlanarClassifierContent.ClassifierOnly;\n combinationBuffer = this._classifierCombinedBuffer;\n } else {\n if (undefined === this._maskBuffer) {\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\n if (undefined === this._maskBuffer)\n return;\n }\n if (undefined === this._classifierAndMaskCombinedBuffer) {\n combinationBuffer = this._classifierAndMaskCombinedBuffer = ClassifierAndMaskCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature, this._maskBuffer.texture);\n if (undefined === this._classifierAndMaskCombinedBuffer)\n return;\n }\n combinationBuffer = this._classifierAndMaskCombinedBuffer;\n this._contentMode = PlanarClassifierContent.ClassifierAndMask;\n }\n }\n\n // Temporarily override the Target's state.\n const system = System.instance;\n const maskViewFlags = {\n renderMode: RenderMode.SmoothShade,\n wiremesh: false,\n transparency: !this.isClassifyingPointCloud, // point clouds don't support transparency.\n textures: false,\n lighting: false,\n shadows: false,\n monochrome: false,\n materials: false,\n ambientOcclusion: false,\n visibleEdges: false,\n hiddenEdges: false,\n };\n const prevState = system.currentRenderState.clone(scratchPrevRenderState);\n system.context.viewport(0, 0, this._width, this._height);\n const vf = target.currentViewFlags.copy(this._classifierTreeRef ? this._classifierTreeRef.viewFlags : maskViewFlags);\n\n system.applyRenderState(this._renderState);\n const prevPlan = target.plan;\n const prevOverrides = target.currentFeatureSymbologyOverrides;\n\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset in changeRenderPlan below.\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\n this._anyTranslucent = false;\n\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\n target.uniforms.frustum.changeProjectionMatrix(PlanarClassifier._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\n target.uniforms.branch.changeRenderPlan(vf, target.plan.is3d, target.plan.hline, target.plan.contours);\n\n const addCmds = (oldCmds: DrawCommands, newCmds: DrawCommands) => {\n if (undefined === newCmds)\n return oldCmds;\n if (newCmds.length > 50000) {\n \t// This method is slower for smaller array sizes, but when the size of newCmds gets larger it's performance is ok.\n return oldCmds.concat(newCmds);\n } else {\n \t// This method runs faster, but gets a stack overflow when the size of newCmds is too large.\n oldCmds.push(...newCmds);\n return oldCmds;\n }\n }\n\n const renderCommands = this._renderCommands;\n const getDrawCommands = (graphics: RenderGraphic[]) => {\n this._batchState.reset();\n renderCommands.reset(target, this._branchStack, this._batchState);\n renderCommands.collectGraphicsForPlanarProjection(graphics);\n\n // Draw the classifiers into our attachments.\n // When using Display.ElementColor, the color and transparency come from the classifier geometry. Therefore we may need to draw the classified geometry\n // in a different pass - or both passes - depending on the transparency of the classifiers.\n // NB: \"Outside\" geometry by definition cannot take color/transparency from element...\n let cmds = renderCommands.getCommands(RenderPass.OpaquePlanar);\n\n // NB: We don't strictly require the classifier geometry to be planar, and sometimes (e.g., \"planar\" polyface/bspsurf) we do not detect planarity.\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.OpaqueGeneral));\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.OpaqueLinear));\n this._anyOpaque = cmds.length > 0;\n const transCmds = renderCommands.getCommands(RenderPass.Translucent);\n if (transCmds.length > 0) {\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.Translucent));\n this._anyTranslucent = true;\n }\n return cmds;\n };\n\n if (this._classifierGraphics.length > 0 && this._classifierBuffers) {\n this._classifierBuffers.draw(getDrawCommands(this._classifierGraphics), target);\n\n // Draw any hilited classifiers.\n const hiliteCommands = renderCommands.getCommands(RenderPass.Hilite);\n this._anyHilited = 0 !== hiliteCommands.length;\n if (this._anyHilited)\n this._classifierBuffers.drawHilite(hiliteCommands, target);\n }\n if (this._maskGraphics.length > 0 && this._maskBuffer) {\n if (this._planarClipMaskOverrides)\n target.overrideFeatureSymbology(this._planarClipMaskOverrides);\n if (this._planarClipMask && this._planarClipMask.settings.transparency !== undefined && this._planarClipMask.settings.transparency > 0.0)\n this._anyTranslucent = true;\n\n this._maskBuffer.draw(getDrawCommands(this._maskGraphics), target);\n\n }\n if (combinationBuffer)\n combinationBuffer.compose(target);\n\n this._batchState.reset();\n target.changeRenderPlan(prevPlan);\n target.overrideFeatureSymbology(prevOverrides);\n\n system.applyRenderState(prevState);\n system.context.viewport(0, 0, target.viewRect.width, target.viewRect.height);\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"PlanarClassifier.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/PlanarClassifier.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,QAAQ,EAAW,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,mBAAmB,GAClJ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,4BAA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gBAClB,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACtD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;gBAClC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBAC/D,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACzE,CAAC;YAED,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,GAAG,GAAG;gBACtI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAE9B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;QAErE,CAAC;QACD,IAAI,iBAAiB;YACnB,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAE/C,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { BeEvent, dispose } from \"@itwin/core-bentley\";\nimport {\n ColorDef, Frustum, FrustumPlanes, RenderMode, RenderTexture, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, TextureTransparency,\n} from \"@itwin/core-common\";\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Range3d, Vector3d } from \"@itwin/core-geometry\";\nimport { PlanarClipMaskState } from \"../../../PlanarClipMaskState\";\nimport { GraphicsCollectorDrawArgs, SpatialClassifierTileTreeReference, TileTreeReference } from \"../../../tile/internal\";\nimport { SceneContext } from \"../../../ViewContext\";\nimport { FeatureSymbology } from \"../../../render/FeatureSymbology\";\nimport { RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { RenderMemory } from \"../../../render/RenderMemory\";\nimport { PlanarClassifierTarget, RenderPlanarClassifier } from \"../RenderPlanarClassifier\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { CachedGeometry, Combine3TexturesGeometry, CombineTexturesGeometry, ViewportQuadGeometry } from \"./CachedGeometry\";\nimport { WebGLDisposable } from \"./Disposable\";\nimport { DrawCommands } from \"./DrawCommand\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { Batch, Branch } from \"./Graphic\";\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass } from \"./RenderFlags\";\nimport { RenderState } from \"./RenderState\";\nimport { getDrawParams } from \"./ScratchDrawParams\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { TechniqueId } from \"./TechniqueId\";\nimport { Texture, TextureHandle } from \"./Texture\";\nimport { ActiveSpatialClassifier } from \"../../../SpatialClassifiersState\";\n\nexport enum PlanarClassifierContent { None = 0, MaskOnly = 1, ClassifierOnly = 2, ClassifierAndMask = 3 }\n\nfunction createTexture(handle: TextureHandle): Texture {\n return new Texture({\n handle,\n ownership: \"external\",\n type: RenderTexture.Type.TileSection,\n transparency: TextureTransparency.Opaque,\n });\n}\n\nfunction createTextureHandle(width: number, height: number, heightMult = 1.0) {\n return TextureHandle.createForAttachment(width, height * heightMult, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n}\n\nclass ClassifierTextures implements WebGLDisposable {\n private constructor(public readonly color: Texture,\n public readonly feature: Texture,\n public readonly hilite: Texture) { }\n\n public get isDisposed(): boolean {\n return this.color.isDisposed\n && this.feature.isDisposed\n && this.hilite.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this.color);\n dispose(this.feature);\n dispose(this.hilite);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n stats.addPlanarClassifier(this.color.bytesUsed);\n stats.addPlanarClassifier(this.feature.bytesUsed);\n stats.addPlanarClassifier(this.hilite.bytesUsed);\n }\n\n public static create(width: number, height: number): ClassifierTextures | undefined {\n const hColor = createTextureHandle(width, height);\n const hFeature = createTextureHandle(width, height);\n const hHilite = createTextureHandle(width, height);\n if (!hColor || !hFeature || !hHilite)\n return undefined;\n\n const color = createTexture(hColor);\n const feature = createTexture(hFeature);\n const hilite = createTexture(hHilite);\n if (!color || !feature || !hilite)\n return undefined;\n\n return new ClassifierTextures(color, feature, hilite);\n }\n}\n\nclass ClassifierFrameBuffers implements WebGLDisposable {\n private constructor(\n public readonly textures: ClassifierTextures,\n private readonly _hilite: FrameBuffer,\n private readonly _fbo: FrameBuffer,\n private readonly _clearGeom: ViewportQuadGeometry) {\n }\n\n public get isDisposed(): boolean {\n return this.textures.isDisposed && this._hilite.isDisposed && this._fbo.isDisposed && this._clearGeom.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this._fbo);\n dispose(this._clearGeom);\n dispose(this.textures);\n dispose(this._hilite);\n }\n\n public draw(cmds: DrawCommands, target: Target): void {\n System.instance.frameBufferStack.execute(this._fbo, true, false, () => {\n target.techniques.draw(getDrawParams(target, this._clearGeom));\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\n });\n }\n\n public drawHilite(cmds: DrawCommands, target: Target): void {\n const system = System.instance;\n const gl = system.context;\n system.frameBufferStack.execute(this._hilite, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.execute(target, cmds, RenderPass.Hilite);\n });\n }\n\n public static create(width: number, height: number): ClassifierFrameBuffers | undefined {\n const textures = ClassifierTextures.create(width, height);\n if (undefined === textures)\n return undefined;\n\n const hiliteFbo = FrameBuffer.create([textures.hilite.texture]);\n if (undefined === hiliteFbo)\n return undefined;\n\n const fbo = FrameBuffer.create([textures.color.texture, textures.feature.texture]);\n if (undefined === fbo)\n return undefined;\n\n const geom = ViewportQuadGeometry.create(TechniqueId.ClearPickAndColor);\n return undefined !== geom ? new this(textures, hiliteFbo, fbo, geom) : undefined;\n }\n}\n\ninterface TextureAndFbo {\n texture: Texture;\n fbo: FrameBuffer;\n}\n\nabstract class SingleTextureFrameBuffer implements WebGLDisposable {\n public texture: Texture;\n protected fbo: FrameBuffer;\n public get isDisposed(): boolean { return this.texture.isDisposed && this.fbo.isDisposed; }\n public collectStatistics(stats: RenderMemory.Statistics): void { stats.addPlanarClassifier(this.texture.bytesUsed); }\n protected constructor(textureAndFbo: TextureAndFbo) {\n this.texture = textureAndFbo.texture;\n this.fbo = textureAndFbo.fbo;\n }\n public [Symbol.dispose](): void {\n dispose(this.texture);\n dispose(this.fbo);\n }\n public static createTextureAndFrameBuffer(width: number, height: number): TextureAndFbo | undefined {\n const hTexture = TextureHandle.createForAttachment(width, height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n if (!hTexture)\n return undefined;\n\n const texture = new Texture({ type: RenderTexture.Type.TileSection, ownership: \"external\", handle: hTexture, transparency: TextureTransparency.Opaque });\n if (!texture)\n return undefined;\n\n const fbo = FrameBuffer.create([texture.texture]);\n if (undefined === fbo)\n return undefined;\n\n return { texture, fbo };\n }\n}\nclass MaskFrameBuffer extends SingleTextureFrameBuffer {\n public static create(width: number, height: number): MaskFrameBuffer | undefined {\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, height);\n return undefined === textureFbo ? undefined : new MaskFrameBuffer(textureFbo);\n }\n public draw(cmds: DrawCommands, target: Target): void {\n const system = System.instance;\n const gl = system.context;\n\n system.frameBufferStack.execute(this.fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.execute(target, cmds, RenderPass.PlanarClassification);\n });\n }\n}\nabstract class CombineTexturesFrameBuffer extends SingleTextureFrameBuffer {\n constructor(textureAndFbo: TextureAndFbo, private _combineGeom: CachedGeometry, private _width: number, private _height: number, private _heightMult: number) { super(textureAndFbo); }\n public compose(target: Target): void {\n const system = System.instance;\n const gl = system.context;\n system.context.viewport(0, 0, this._width, this._heightMult * this._height);\n system.frameBufferStack.execute(this.fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\n target.techniques.draw(getDrawParams(target, this._combineGeom));\n });\n }\n}\n\nclass ClassifierCombinationBuffer extends CombineTexturesFrameBuffer {\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture): ClassifierAndMaskCombinationBuffer | undefined {\n const combineGeom = CombineTexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!);\n if (undefined === combineGeom)\n return undefined;\n\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 2 * height);\n return undefined === textureFbo ? undefined : new ClassifierCombinationBuffer(textureFbo, combineGeom, width, height, 2);\n }\n}\nclass ClassifierAndMaskCombinationBuffer extends CombineTexturesFrameBuffer {\n public static create(width: number, height: number, classifierColor: Texture, classifierFeature: Texture, mask: Texture): ClassifierAndMaskCombinationBuffer | undefined {\n const combineGeom = Combine3TexturesGeometry.createGeometry(classifierColor.texture.getHandle()!, classifierFeature.texture.getHandle()!, mask.texture.getHandle()!);\n if (undefined === combineGeom)\n return undefined;\n\n const textureFbo = SingleTextureFrameBuffer.createTextureAndFrameBuffer(width, 3 * height);\n return undefined === textureFbo ? undefined : new ClassifierAndMaskCombinationBuffer(textureFbo, combineGeom, width, height, 3);\n }\n}\n\nconst scratchPrevRenderState = new RenderState();\n\n/** @internal */\nexport class PlanarClassifier extends RenderPlanarClassifier implements RenderMemory.Consumer, WebGLDisposable {\n private _classifierBuffers?: ClassifierFrameBuffers;\n private _maskBuffer?: MaskFrameBuffer;\n private _classifierCombinedBuffer?: ClassifierCombinationBuffer;\n private _classifierAndMaskCombinedBuffer?: ClassifierAndMaskCombinationBuffer;\n private _projectionMatrix = Matrix4d.createIdentity();\n private _graphics?: RenderGraphic[];\n private readonly _classifierGraphics: RenderGraphic[] = [];\n private readonly _maskGraphics: RenderGraphic[] = [];\n private _frustum?: Frustum;\n private _width = 0;\n private _height = 0;\n private _baseBatchId = 0;\n private _anyHilited = false;\n private _anyOpaque = false;\n private _anyTranslucent = false;\n private _classifier?: ActiveSpatialClassifier;\n private readonly _plane = Plane3dByOriginAndUnitNormal.create(new Point3d(0, 0, 0), new Vector3d(0, 0, 1))!; // TBD -- Support other planes - default to X-Y for now.\n private readonly _renderState = new RenderState();\n private readonly _renderCommands: RenderCommands;\n private readonly _branchStack = new BranchStack();\n private readonly _batchState: BatchState;\n private _planarClipMask?: PlanarClipMaskState;\n private _classifierTreeRef?: SpatialClassifierTileTreeReference;\n private _planarClipMaskOverrides?: FeatureSymbology.Overrides;\n private _overridesDirty = true;\n private _contentMode: PlanarClassifierContent = PlanarClassifierContent.None;\n private _removeMe?: () => void;\n private _featureSymbologySource: FeatureSymbology.Source = {\n onSourceDisposed: new BeEvent<() => void>(),\n };;\n\n private static _postProjectionMatrix = Matrix4d.createRowValues(\n 0, 1, 0, 0,\n 0, 0, -1, 0,\n 1, 0, 0, 0,\n 0, 0, 0, 1);\n private _debugFrustum?: Frustum;\n private _doDebugFrustum = false;\n private _debugFrustumGraphic?: RenderGraphic = undefined;\n private _isClassifyingPointCloud?: boolean; // we will detect this the first time we draw\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\n\n private constructor(classifier: ActiveSpatialClassifier | undefined, target: Target) {\n super();\n this._classifier = classifier;\n\n const flags = this._renderState.flags;\n flags.depthMask = flags.blend = flags.depthTest = false;\n\n this._batchState = new BatchState(this._branchStack);\n this._renderCommands = new RenderCommands(target, this._branchStack, this._batchState);\n }\n public get textureImageCount(): number { return this._contentMode; }\n\n public getParams(params: Float32Array): void {\n params[0] = this.insideDisplay;\n params[1] = this.outsideDisplay;\n params[2] = this._contentMode;\n if (this._planarClipMask?.settings.invert) // If the mask sense is inverted, negate the contentMode to indicate this to the shader.\n params[2] = - params[2];\n\n params[3] = (this._planarClipMask?.settings.transparency === undefined) ? -1 : this._planarClipMask.settings.transparency;\n\n }\n\n public get hiliteTexture(): Texture | undefined { return undefined !== this._classifierBuffers ? this._classifierBuffers.textures.hilite : undefined; }\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\n // public get properties(): SpatialClassifier { return this._classifier; }\n public get baseBatchId(): number { return this._baseBatchId; }\n public get anyHilited(): boolean { return this._anyHilited; }\n public get anyOpaque(): boolean { return this._anyOpaque; }\n public get anyTranslucent(): boolean { return this._anyTranslucent; }\n public get insideDisplay(): SpatialClassifierInsideDisplay { return this._classifier ? this._classifier.flags.inside : SpatialClassifierInsideDisplay.Off; }\n public get outsideDisplay(): SpatialClassifierOutsideDisplay { return this._classifier ? this._classifier.flags.outside : SpatialClassifierOutsideDisplay.On; }\n public get isClassifyingPointCloud(): boolean { return true === this._isClassifyingPointCloud; }\n\n public addGraphic(graphic: RenderGraphic) {\n this._graphics!.push(graphic);\n }\n\n public static create(properties: ActiveSpatialClassifier | undefined, target: Target): PlanarClassifier {\n return new PlanarClassifier(properties, target);\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n if (undefined !== this._classifierBuffers)\n this._classifierBuffers.textures.collectStatistics(stats);\n\n if (undefined !== this._maskBuffer)\n this._maskBuffer.collectStatistics(stats);\n\n if (undefined !== this._classifierCombinedBuffer)\n this._classifierCombinedBuffer.collectStatistics(stats);\n\n if (undefined !== this._classifierAndMaskCombinedBuffer)\n this._classifierAndMaskCombinedBuffer.collectStatistics(stats);\n }\n\n public get isDisposed(): boolean { return undefined === this._classifierBuffers; }\n\n public [Symbol.dispose]() {\n this._classifierBuffers = dispose(this._classifierBuffers);\n this._maskBuffer = dispose(this._maskBuffer);\n this._classifierCombinedBuffer = dispose(this._classifierCombinedBuffer);\n this._classifierAndMaskCombinedBuffer = dispose(this._classifierAndMaskCombinedBuffer);\n if (this._removeMe) {\n this._removeMe();\n this._removeMe = undefined;\n }\n this._featureSymbologySource.onSourceDisposed.raiseEvent();\n }\n\n public get texture(): Texture | undefined {\n switch (this._contentMode) {\n case PlanarClassifierContent.None:\n return undefined;\n case PlanarClassifierContent.ClassifierOnly:\n return this._classifierCombinedBuffer?.texture;\n case PlanarClassifierContent.MaskOnly:\n return this._maskBuffer?.texture;\n case PlanarClassifierContent.ClassifierAndMask:\n return this._classifierAndMaskCombinedBuffer?.texture;\n }\n }\n public getOrCreateClassifierTexture(): Texture | undefined {\n if (undefined === this._classifierBuffers)\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\n if (undefined !== this._classifierBuffers && undefined === this._classifierCombinedBuffer)\n this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\n\n return this._classifierCombinedBuffer?.texture;\n }\n\n private pushBatches(batchState: BatchState, graphics: RenderGraphic[]) {\n graphics.forEach((graphic) => {\n if (graphic instanceof Batch) {\n batchState.push(graphic, true);\n batchState.pop();\n } else if (graphic instanceof Branch) {\n this.pushBatches(batchState, graphic.branch.entries);\n }\n });\n }\n public get sourceTransparency() {\n return this._classifierTreeRef?.transparency;\n }\n\n public pushBatchState(batchState: BatchState) {\n this._baseBatchId = batchState.nextBatchId - 1;\n if (undefined !== this._classifierGraphics)\n this.pushBatches(batchState, this._classifierGraphics);\n }\n\n public setSource(classifierTreeRef?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState) {\n this._classifierTreeRef = classifierTreeRef;\n this._classifier = classifierTreeRef?.activeClassifier;\n this._planarClipMask = planarClipMask;\n }\n\n public collectGraphics(context: SceneContext, target: PlanarClassifierTarget): void {\n this._classifierGraphics.length = this._maskGraphics.length = 0;\n if (undefined === context.viewingSpace)\n return;\n\n const viewState = context.viewingSpace.view;\n if (!viewState.isSpatialView())\n return;\n\n this._doDebugFrustum = context.target.debugControl?.displayMaskFrustum ?? false;\n\n const maxTextureSize = System.instance.maxTexSizeAllow;\n const requiredHeight = maxTextureSize;\n const requiredWidth = maxTextureSize;\n if (requiredWidth !== this._width || requiredHeight !== this._height)\n this[Symbol.dispose]();\n\n this._width = requiredWidth;\n this._height = requiredHeight;\n const maskRange = Range3d.createNull();\n const maskTrees = this._planarClipMask?.getTileTrees(context, target.modelId, maskRange);\n if (!maskTrees && !this._classifierTreeRef)\n return;\n\n const allTrees = maskTrees ? maskTrees.slice() : new Array<TileTreeReference>();\n if (this._classifierTreeRef)\n allTrees.push(this._classifierTreeRef);\n\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, target, allTrees, viewState, this._width, this._height, maskRange);\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\n return;\n\n this._projectionMatrix = projection.projectionMatrix;\n this._frustum = projection.textureFrustum;\n this._debugFrustum = projection.debugFrustum;\n if (this._overridesDirty) {\n this._overridesDirty = false;\n this._planarClipMaskOverrides = this._planarClipMask?.getPlanarClipMaskSymbologyOverrides(context, this._featureSymbologySource);\n }\n\n if (!this._planarClipMask?.usingViewportOverrides && this._removeMe) {\n this._removeMe();\n this._removeMe = undefined;\n } else if (this._planarClipMask?.usingViewportOverrides && !this._removeMe) {\n this._removeMe = context.viewport.onFeatureOverridesChanged.addListener(() => {\n this._overridesDirty = true;\n context.viewport.requestRedraw();\n });\n }\n\n const drawTree = (treeRef: TileTreeReference, graphics: RenderGraphic[]) => {\n this._graphics = graphics;\n const frustumPlanes = this._frustum ? FrustumPlanes.fromFrustum(this._frustum) : FrustumPlanes.createEmpty();\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, treeRef, frustumPlanes, projection.worldToViewMap!);\n if (undefined !== drawArgs)\n treeRef.draw(drawArgs);\n\n this._graphics = undefined;\n };\n if (this._classifierTreeRef)\n drawTree(this._classifierTreeRef, this._classifierGraphics);\n\n if (maskTrees)\n maskTrees.forEach((maskTree) => drawTree(maskTree, this._maskGraphics));\n\n // Shader behaves slightly differently when classifying surfaces vs point clouds.\n this._isClassifyingPointCloud = target.isPointCloud;\n\n if (this._doDebugFrustum) {\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\n const builder = context.createSceneGraphicBuilder();\n\n builder.setSymbology(ColorDef.green, ColorDef.green, 2);\n builder.addFrustum(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.red, ColorDef.red, 2);\n builder.addFrustum(this._debugFrustum!);\n builder.setSymbology(ColorDef.blue, ColorDef.blue, 2);\n builder.addFrustum(this._frustum);\n\n builder.setSymbology(ColorDef.from(0, 200, 0, 222), ColorDef.from(0, 200, 0, 222), 2);\n builder.addFrustumSides(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.from(200, 0, 0, 222), ColorDef.from(200, 0, 0, 222), 2);\n builder.addFrustumSides(this._debugFrustum!);\n builder.setSymbology(ColorDef.from(0, 0, 200, 222), ColorDef.from(0, 0, 200, 222), 2);\n builder.addFrustumSides(this._frustum);\n this._debugFrustumGraphic = builder.finish();\n context.outputGraphic(this._debugFrustumGraphic);\n }\n }\n\n public draw(target: Target) {\n if (undefined === this._frustum)\n return;\n\n this._contentMode = PlanarClassifierContent.None;\n let combinationBuffer: ClassifierCombinationBuffer | undefined;\n if (this._classifierGraphics.length === 0) {\n if (this._maskGraphics.length === 0) {\n return;\n } else {\n if (undefined === this._maskBuffer) {\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\n if (undefined === this._maskBuffer)\n return;\n }\n this._contentMode = PlanarClassifierContent.MaskOnly;\n }\n } else {\n if (undefined === this._classifierBuffers) {\n this._classifierBuffers = ClassifierFrameBuffers.create(this._width, this._height);\n if (undefined === this._classifierBuffers)\n return;\n }\n if (this._maskGraphics.length === 0) {\n if (undefined === this._classifierCombinedBuffer) {\n combinationBuffer = this._classifierCombinedBuffer = ClassifierCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature);\n if (undefined === this._classifierCombinedBuffer)\n return;\n }\n this._contentMode = PlanarClassifierContent.ClassifierOnly;\n combinationBuffer = this._classifierCombinedBuffer;\n } else {\n if (undefined === this._maskBuffer) {\n this._maskBuffer = MaskFrameBuffer.create(this._width, this._height);\n if (undefined === this._maskBuffer)\n return;\n }\n if (undefined === this._classifierAndMaskCombinedBuffer) {\n combinationBuffer = this._classifierAndMaskCombinedBuffer = ClassifierAndMaskCombinationBuffer.create(this._width, this._height, this._classifierBuffers.textures.color, this._classifierBuffers.textures.feature, this._maskBuffer.texture);\n if (undefined === this._classifierAndMaskCombinedBuffer)\n return;\n }\n combinationBuffer = this._classifierAndMaskCombinedBuffer;\n this._contentMode = PlanarClassifierContent.ClassifierAndMask;\n }\n }\n\n // Temporarily override the Target's state.\n const system = System.instance;\n const maskViewFlags = {\n renderMode: RenderMode.SmoothShade,\n wiremesh: false,\n transparency: !this.isClassifyingPointCloud, // point clouds don't support transparency.\n textures: false,\n lighting: false,\n shadows: false,\n monochrome: false,\n materials: false,\n ambientOcclusion: false,\n visibleEdges: false,\n hiddenEdges: false,\n };\n const prevState = system.currentRenderState.clone(scratchPrevRenderState);\n system.context.viewport(0, 0, this._width, this._height);\n const vf = target.currentViewFlags.copy(this._classifierTreeRef ? this._classifierTreeRef.viewFlags : maskViewFlags);\n\n system.applyRenderState(this._renderState);\n const prevPlan = target.plan;\n const prevOverrides = target.currentFeatureSymbologyOverrides;\n\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset in changeRenderPlan below.\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\n this._anyTranslucent = false;\n\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\n target.uniforms.frustum.changeProjectionMatrix(PlanarClassifier._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\n target.uniforms.branch.changeRenderPlan(vf, target.plan.is3d, target.plan.hline, target.plan.contours);\n\n const addCmds = (oldCmds: DrawCommands, newCmds: DrawCommands) => {\n if (undefined === newCmds)\n return oldCmds;\n if (newCmds.length > 50000) {\n \t// This method is slower for smaller array sizes, but when the size of newCmds gets larger it's performance is ok.\n return oldCmds.concat(newCmds);\n } else {\n \t// This method runs faster, but gets a stack overflow when the size of newCmds is too large.\n oldCmds.push(...newCmds);\n return oldCmds;\n }\n }\n\n const renderCommands = this._renderCommands;\n const getDrawCommands = (graphics: RenderGraphic[]) => {\n this._batchState.reset();\n renderCommands.reset(target, this._branchStack, this._batchState);\n if (this._planarClipMask?.overridesModelVisibility) {\n // We're using batched tiles and the mask is overriding which models are visible versus those visible in the view.\n // We don't want the BatchedTileTreeReference to hide models that belong in the mask.\n // The target's root branch's symbology overrides are set up correctly for the mask, and we never push branches to the target\n // (we have a separate branch stack), so just use the root branch as the appearance provider instead of the branch stack.\n // NOTE: this doesn't work if we're inside a GraphicalEditingScope displaying temporary graphics for some elements, because those\n // elements are hidden in the tiles by a FeatureAppearanceProvider. But we'll never use a GraphicalEditingScope with batched tiles,\n // and non-batched tiles never hide models using symbology overrides.\n renderCommands.appearanceProvider = target.currentBranch;\n }\n\n renderCommands.collectGraphicsForPlanarProjection(graphics);\n\n // Draw the classifiers into our attachments.\n // When using Display.ElementColor, the color and transparency come from the classifier geometry. Therefore we may need to draw the classified geometry\n // in a different pass - or both passes - depending on the transparency of the classifiers.\n // NB: \"Outside\" geometry by definition cannot take color/transparency from element...\n let cmds = renderCommands.getCommands(RenderPass.OpaquePlanar);\n\n // NB: We don't strictly require the classifier geometry to be planar, and sometimes (e.g., \"planar\" polyface/bspsurf) we do not detect planarity.\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.OpaqueGeneral));\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.OpaqueLinear));\n this._anyOpaque = cmds.length > 0;\n const transCmds = renderCommands.getCommands(RenderPass.Translucent);\n if (transCmds.length > 0) {\n cmds = addCmds(cmds, renderCommands.getCommands(RenderPass.Translucent));\n this._anyTranslucent = true;\n }\n return cmds;\n };\n\n if (this._classifierGraphics.length > 0 && this._classifierBuffers) {\n this._classifierBuffers.draw(getDrawCommands(this._classifierGraphics), target);\n\n // Draw any hilited classifiers.\n const hiliteCommands = renderCommands.getCommands(RenderPass.Hilite);\n this._anyHilited = 0 !== hiliteCommands.length;\n if (this._anyHilited)\n this._classifierBuffers.drawHilite(hiliteCommands, target);\n }\n if (this._maskGraphics.length > 0 && this._maskBuffer) {\n if (this._planarClipMaskOverrides) {\n target.overrideFeatureSymbology(this._planarClipMaskOverrides);\n this._branchStack.setSymbologyOverrides(this._planarClipMaskOverrides);\n }\n\n if (this._planarClipMask && this._planarClipMask.settings.transparency !== undefined && this._planarClipMask.settings.transparency > 0.0)\n this._anyTranslucent = true;\n\n this._maskBuffer.draw(getDrawCommands(this._maskGraphics), target);\n\n }\n if (combinationBuffer)\n combinationBuffer.compose(target);\n\n this._batchState.reset();\n target.changeRenderPlan(prevPlan);\n target.overrideFeatureSymbology(prevOverrides);\n\n system.applyRenderState(prevState);\n system.context.viewport(0, 0, target.viewRect.width, target.viewRect.height);\n }\n}\n\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module WebGL
|
|
3
3
|
*/
|
|
4
|
-
import { Frustum, ViewFlags } from "@itwin/core-common";
|
|
4
|
+
import { FeatureAppearanceProvider, Frustum, ViewFlags } from "@itwin/core-common";
|
|
5
5
|
import { GraphicList } from "../../../render/RenderGraphic";
|
|
6
6
|
import { BranchStack } from "./BranchStack";
|
|
7
7
|
import { BatchState } from "./BatchState";
|
|
@@ -30,6 +30,7 @@ export declare class RenderCommands implements Iterable<DrawCommands> {
|
|
|
30
30
|
private _translucentOverrides;
|
|
31
31
|
private _addTranslucentAsOpaque;
|
|
32
32
|
private readonly _layers;
|
|
33
|
+
appearanceProvider?: FeatureAppearanceProvider;
|
|
33
34
|
get target(): Target;
|
|
34
35
|
[Symbol.iterator](): Iterator<DrawCommands>;
|
|
35
36
|
get isEmpty(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderCommands.d.ts","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/RenderCommands.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,OAAO,EAA6B,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"RenderCommands.d.ts","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/RenderCommands.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,yBAAyB,EAAE,OAAO,EAA6B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG9G,OAAO,EAAE,WAAW,EAAiB,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,YAAY,EAAiE,gBAAgB,EAE9F,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,O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IAalB,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IAM3D,KAAK,IAAI,IAAI;IAKpB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,6BAA6B;IAQ9B,mBAAmB,CAAC,aAAa,EAAE,WAAW,EAAE,uBAAuB,EAAE,WAAW,GAAG,SAAS,EAAE,sBAAsB,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI;IAuBxJ,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IAsB5C,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IAmCxC,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IA2BnC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM/B,4BAA4B,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU;IAwBtD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAsE5B,aAAa,CAAC,OAAO,EAAE,OAAO;IAE9B,eAAe,IAAI,IAAI;IAE9B,OAAO,CAAC,2BAA2B;IAkC5B,IAAI,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CA8BtD"}
|
|
@@ -31,6 +31,7 @@ export class RenderCommands {
|
|
|
31
31
|
_translucentOverrides = false;
|
|
32
32
|
_addTranslucentAsOpaque = false; // true when rendering for _ReadPixels to force translucent items to be drawn in opaque pass.
|
|
33
33
|
_layers;
|
|
34
|
+
appearanceProvider;
|
|
34
35
|
get target() { return this._target; }
|
|
35
36
|
[Symbol.iterator]() {
|
|
36
37
|
return this._commands[Symbol.iterator]();
|
|
@@ -77,6 +78,7 @@ export class RenderCommands {
|
|
|
77
78
|
this._target = target;
|
|
78
79
|
this._stack = stack;
|
|
79
80
|
this._batchState = batchState;
|
|
81
|
+
this.appearanceProvider = undefined;
|
|
80
82
|
this.clear();
|
|
81
83
|
}
|
|
82
84
|
collectGraphicsForPlanarProjection(scene) {
|
|
@@ -517,7 +519,7 @@ export class RenderCommands {
|
|
|
517
519
|
assert(!this._opaqueOverrides && !this._translucentOverrides);
|
|
518
520
|
assert(undefined === this._curBatch);
|
|
519
521
|
// If all features are overridden to be invisible, draw no graphics in this batch
|
|
520
|
-
const overrides = batch.getOverrides(this.target);
|
|
522
|
+
const overrides = batch.getOverrides(this.target, this.appearanceProvider ?? this._stack.top);
|
|
521
523
|
if (overrides.allHidden)
|
|
522
524
|
return;
|
|
523
525
|
if (!batch.range.isNull) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderCommands.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/RenderCommands.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAM5E,OAAO,EACS,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAc,gBAAgB,EAAE,gBAAgB,EAC/G,iBAAiB,EAAE,eAAe,EAAe,gBAAgB,GAClE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAS,MAAM,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAkB,IAAI,EAA2B,MAAM,eAAe,CAAC;AAK9E;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,cAAc,CAAiB;IACtB,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,aAAa,GAAG,IAAI,OAAO,EAAE,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,GAAG,EAAE,CAAC;oBACnB,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;IAEM,IAAI;QACT,MAAM,IAAI,GAAG;YACX,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE;YAChC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE;YAC7B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE;SAC/B,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAClC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,KAAK,CAAC;gBACV,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;oBACnB,KAAK,eAAe;wBAClB,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR,KAAK,WAAW;wBACd,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR,KAAK,YAAY;wBACf,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR;wBACE,SAAS;gBACb,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { Frustum, FrustumPlanes, RenderMode, ViewFlags } from \"@itwin/core-common\";\nimport { Decorations } from \"../../../render/Decorations\";\nimport { SurfaceType } from \"../../../common/internal/render/SurfaceParams\";\nimport { GraphicList, RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { AnimationBranchState } from \"../AnimationBranchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchState } from \"./BranchState\";\nimport {\n DrawCommands, PopBatchCommand, PopBranchCommand, PopClipCommand, PopCommand, PrimitiveCommand, PushBatchCommand,\n PushBranchCommand, PushClipCommand, PushCommand, PushStateCommand,\n} from \"./DrawCommand\";\nimport { Batch, Branch, Graphic, GraphicsArray } from \"./Graphic\";\nimport { Layer, LayerContainer } from \"./Layer\";\nimport { LayerCommandLists } from \"./LayerCommands\";\nimport { MeshGraphic } from \"./Mesh\";\nimport { Primitive } from \"./Primitive\";\nimport { CompositeFlags, Pass, RenderOrder, RenderPass } from \"./RenderFlags\";\nimport { TargetGraphics } from \"./TargetGraphics\";\nimport { Target } from \"./Target\";\nimport { ClipVolume } from \"./ClipVolume\";\n\n/** A list of DrawCommands to be rendered, ordered by render pass.\n * @internal\n */\nexport class RenderCommands implements Iterable<DrawCommands> {\n private _frustumPlanes?: FrustumPlanes;\n private readonly _scratchFrustum = new Frustum();\n private readonly _scratchRange = new Range3d();\n private readonly _commands = new Array<DrawCommands>(RenderPass.COUNT);\n private _target: Target;\n private _stack: BranchStack; // refers to the Target's BranchStack\n private _batchState: BatchState; // refers to the Target's BatchState\n private _forcedRenderPass: RenderPass = RenderPass.None;\n private _addLayersAsNormalGraphics = false;\n private _opaqueOverrides = false;\n private _translucentOverrides = false;\n private _addTranslucentAsOpaque = false; // true when rendering for _ReadPixels to force translucent items to be drawn in opaque pass.\n private readonly _layers: LayerCommandLists;\n\n public get target(): Target { return this._target; }\n\n public [Symbol.iterator](): Iterator<DrawCommands> {\n return this._commands[Symbol.iterator]();\n }\n\n public get isEmpty(): boolean {\n for (const commands of this._commands)\n if (0 < commands.length)\n return false;\n\n return true;\n }\n\n public get isDrawingLayers() {\n switch (this._forcedRenderPass) {\n case RenderPass.OpaqueLayers:\n case RenderPass.TranslucentLayers:\n case RenderPass.OverlayLayers:\n return true;\n default:\n return false;\n }\n }\n\n public get currentViewFlags(): ViewFlags { return this._stack.top.viewFlags; }\n public get compositeFlags(): CompositeFlags {\n let flags = CompositeFlags.None;\n if (this.hasCommands(RenderPass.Translucent))\n flags |= CompositeFlags.Translucent;\n\n if (this.hasCommands(RenderPass.Hilite) || this.hasCommands(RenderPass.HiliteClassification) || this.hasCommands(RenderPass.HilitePlanarClassification))\n flags |= CompositeFlags.Hilite;\n\n if (this.target.wantAmbientOcclusion)\n flags |= CompositeFlags.AmbientOcclusion;\n\n return flags;\n }\n\n private get _curBatch(): Batch | undefined { return this._batchState.currentBatch; }\n\n public hasCommands(pass: RenderPass): boolean { return 0 !== this.getCommands(pass).length; }\n public isOpaquePass(pass: RenderPass): boolean { return pass >= RenderPass.OpaqueLinear && pass <= RenderPass.OpaqueGeneral; }\n\n constructor(target: Target, stack: BranchStack, batchState: BatchState) {\n this._target = target;\n this._stack = stack;\n this._batchState = batchState;\n this._layers = new LayerCommandLists(this);\n\n for (let i = 0; i < RenderPass.COUNT; ++i)\n this._commands[i] = [];\n }\n\n public reset(target: Target, stack: BranchStack, batchState: BatchState): void {\n this._target = target;\n this._stack = stack;\n this._batchState = batchState;\n this.clear();\n }\n\n public collectGraphicsForPlanarProjection(scene: GraphicList): void {\n assert(this._forcedRenderPass === RenderPass.None);\n assert(!this._addLayersAsNormalGraphics);\n\n this._addLayersAsNormalGraphics = true;\n this.addGraphics(scene);\n this._addLayersAsNormalGraphics = false;\n }\n\n public addGraphics(scene: GraphicList, forcedPass: RenderPass = RenderPass.None): void {\n this._forcedRenderPass = forcedPass;\n scene.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n /** Add backgroundMap graphics to their own render pass. */\n public addBackgroundMapGraphics(backgroundMapGraphics: GraphicList): void {\n this._forcedRenderPass = RenderPass.BackgroundMap;\n backgroundMapGraphics.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n /** Add overlay graphics to the world overlay pass */\n public addOverlayGraphics(overlayGraphics: GraphicList): void {\n this._forcedRenderPass = RenderPass.WorldOverlay;\n overlayGraphics.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addDecorations(dec: GraphicList, forcedPass: RenderPass = RenderPass.None): void {\n this._forcedRenderPass = forcedPass;\n for (const entry of dec) {\n (entry as Graphic).addCommands(this);\n }\n\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addWorldDecorations(decs: GraphicList): void {\n const world = this.target.getWorldDecorations(decs);\n this.pushAndPopBranch(world, () => {\n for (const entry of world.branch.entries) {\n (entry as Graphic).addCommands(this);\n }\n });\n }\n\n private addPickableDecorations(decs: Decorations): void {\n if (undefined !== decs.normal) {\n for (const normal of decs.normal) {\n const gf = normal as Graphic;\n if (gf.isPickable)\n gf.addCommands(this);\n }\n }\n\n if (undefined !== decs.world) {\n const world = this.target.getWorldDecorations(decs.world);\n this.pushAndPopBranch(world, () => {\n for (const gf of world.branch.entries) {\n if ((gf as Graphic).isPickable)\n (gf as Graphic).addCommands(this);\n }\n });\n }\n }\n\n public addBackground(gf?: Graphic): void {\n if (undefined === gf)\n return;\n\n assert(RenderPass.None === this._forcedRenderPass);\n\n this._forcedRenderPass = RenderPass.Background;\n this.pushAndPopState(this.target.decorationsState, () => gf.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addSkyBox(gf?: Graphic): void {\n if (undefined === gf)\n return;\n\n assert(RenderPass.None === this._forcedRenderPass);\n\n this._forcedRenderPass = RenderPass.SkyBox;\n this.pushAndPopState(this.target.decorationsState, () => gf.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addPrimitiveCommand(command: PrimitiveCommand, pass?: Pass): void {\n if (undefined === pass)\n pass = command.getPass(this.target);\n\n if (\"none\" === pass) // Edges will return none if they don't want to draw at all (edges not turned on).\n return;\n\n if (RenderPass.None !== this._forcedRenderPass) {\n // Add the command to the forced render pass (background).\n this.getCommands(this._forcedRenderPass).push(command);\n return;\n }\n\n if (!command.hasFeatures) {\n // Draw in general opaque pass so they are not in pick data.\n switch (pass) {\n case \"opaque-linear\":\n case \"opaque-planar\":\n pass = \"opaque\";\n break;\n case \"opaque-planar-translucent\":\n pass = \"opaque-translucent\";\n break;\n }\n }\n\n const haveFeatureOverrides = (this._opaqueOverrides || this._translucentOverrides) && command.opcode && command.hasFeatures;\n\n if (Pass.rendersTranslucent(pass) && this._addTranslucentAsOpaque) {\n switch (command.renderOrder) {\n case RenderOrder.PlanarLitSurface:\n case RenderOrder.PlanarUnlitSurface:\n case RenderOrder.BlankingRegion:\n pass = \"opaque-planar\";\n break;\n case RenderOrder.LitSurface:\n case RenderOrder.UnlitSurface:\n pass = \"opaque\";\n break;\n default:\n pass = \"opaque-linear\";\n break;\n }\n }\n\n const isDoublePass = Pass.rendersOpaqueAndTranslucent(pass);\n const renderTranslucentDuringOpaque = isDoublePass || (this._opaqueOverrides && haveFeatureOverrides);\n if (renderTranslucentDuringOpaque && Pass.rendersTranslucent(pass) && !command.primitive.cachedGeometry.alwaysRenderTranslucent) {\n let opaquePass: RenderPass;\n if (Pass.rendersOpaqueAndTranslucent(pass)) {\n opaquePass = Pass.toOpaquePass(pass);\n } else {\n switch (command.renderOrder) {\n case RenderOrder.PlanarLitSurface:\n case RenderOrder.PlanarUnlitSurface:\n case RenderOrder.BlankingRegion:\n opaquePass = RenderPass.OpaquePlanar;\n break;\n case RenderOrder.LitSurface:\n case RenderOrder.UnlitSurface:\n opaquePass = RenderPass.OpaqueGeneral;\n break;\n default:\n opaquePass = RenderPass.OpaqueLinear;\n break;\n }\n }\n\n this.getCommands(opaquePass).push(command);\n }\n\n const renderOpaqueDuringTranslucent = isDoublePass || (this._translucentOverrides && haveFeatureOverrides);\n if (renderOpaqueDuringTranslucent && Pass.rendersOpaque(pass) && !this._addTranslucentAsOpaque)\n this.getCommands(RenderPass.Translucent).push(command);\n\n if (!Pass.rendersOpaqueAndTranslucent(pass))\n this.getCommands(Pass.toRenderPass(pass)).push(command);\n }\n\n public getCommands(pass: RenderPass): DrawCommands {\n let idx = pass as number;\n assert(idx < this._commands.length);\n if (idx >= this._commands.length)\n idx -= 1;\n\n return this._commands[idx];\n }\n\n public replaceCommands(pass: RenderPass, cmds: DrawCommands): void {\n const idx = pass as number;\n this._commands[idx].splice(0);\n this._commands[idx] = cmds;\n }\n\n public addHiliteBranch(branch: Branch, pass: RenderPass): void {\n this.pushAndPopBranchForPass(pass, branch, () => {\n branch.branch.entries.forEach((entry: RenderGraphic) => (entry as Graphic).addHiliteCommands(this, pass));\n });\n }\n\n public processLayers(container: LayerContainer): void {\n assert(RenderPass.None === this._forcedRenderPass);\n if (RenderPass.None !== this._forcedRenderPass)\n return;\n\n this._forcedRenderPass = container.renderPass;\n this._layers.processLayers(container, () => container.graphic.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addLayerCommands(layer: Layer): void {\n if (this._addLayersAsNormalGraphics) {\n // GraphicsCollectorDrawArgs wants to collect graphics to project to a plane for masking.\n // It bypasses PlanProjectionTreeReference.createDrawArgs which would otherwise wrap the graphics in a LayerContainer.\n assert(this._forcedRenderPass === RenderPass.None);\n this._forcedRenderPass = RenderPass.OpaqueGeneral;\n layer.graphic.addCommands(this);\n this._forcedRenderPass = RenderPass.None;\n return;\n }\n\n assert(this.isDrawingLayers);\n if (!this.isDrawingLayers)\n return;\n\n // Let the graphic add its commands. Afterward, pull them out and add them to the LayerCommands.\n this._layers.currentLayer = layer;\n layer.graphic.addCommands(this);\n\n const cmds = this.getCommands(this._forcedRenderPass);\n this._layers.addCommands(cmds);\n\n cmds.length = 0;\n this._layers.currentLayer = undefined;\n }\n\n public addHiliteLayerCommands(graphic: Graphic, pass: RenderPass): void {\n assert(this.isDrawingLayers || this._addLayersAsNormalGraphics);\n if (!this.isDrawingLayers && !this._addLayersAsNormalGraphics)\n return;\n\n const prevPass = this._forcedRenderPass;\n this._forcedRenderPass = RenderPass.None;\n\n graphic.addHiliteCommands(this, pass);\n\n this._forcedRenderPass = prevPass;\n }\n\n private getAnimationBranchState(branch: Branch): AnimationBranchState | undefined {\n const animId = branch.branch.animationId;\n return undefined !== animId ? this.target.animationBranches?.branchStates.get(animId) : undefined;\n }\n\n private pushAndPopBranchForPass(pass: RenderPass, branch: Branch, func: () => void): void {\n assert(!this.isDrawingLayers);\n\n const animState = this.getAnimationBranchState(branch);\n if (animState?.omit)\n return;\n\n assert(RenderPass.None !== pass);\n\n this._stack.pushBranch(branch);\n if (branch.planarClassifier)\n branch.planarClassifier.pushBatchState(this._batchState);\n\n if (branch.secondaryClassifiers)\n branch.secondaryClassifiers.forEach((classifier) => classifier.pushBatchState(this._batchState));\n\n const cmds = this.getCommands(pass);\n const clip = animState?.clip as ClipVolume | undefined;\n const pushClip = undefined !== clip ? new PushClipCommand(clip) : undefined;\n if (pushClip)\n cmds.push(pushClip);\n\n const push = new PushBranchCommand(branch);\n cmds.push(push);\n\n func();\n\n this._stack.pop();\n if (cmds[cmds.length - 1] === push) {\n cmds.pop();\n if (pushClip)\n cmds.pop();\n } else {\n cmds.push(PopBranchCommand.instance);\n if (pushClip)\n cmds.push(PopClipCommand.instance);\n }\n }\n\n private pushAndPop(push: PushCommand, pop: PopCommand, func: () => void): void {\n if (this.isDrawingLayers) {\n this._commands[RenderPass.Hilite].push(push);\n this._layers.pushAndPop(push, pop, func);\n\n const cmds = this._commands[RenderPass.Hilite];\n if (0 < cmds.length && cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n\n return;\n }\n\n if (RenderPass.None === this._forcedRenderPass) {\n // Need to make sure the push command precedes any subsequent commands added to any render pass.\n for (const cmds of this._commands)\n cmds.push(push);\n } else {\n // May want to add hilite commands as well - add the push command to that pass.\n this._commands[this._forcedRenderPass].push(push);\n this._commands[RenderPass.Hilite].push(push);\n }\n\n func();\n\n // Remove push command from any passes that didn't receive any commands; add the pop command to any passes that did.\n if (RenderPass.None === this._forcedRenderPass) {\n for (const cmds of this._commands) {\n assert(0 < cmds.length);\n if (0 < cmds.length && cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n }\n } else {\n assert(0 < this._commands[this._forcedRenderPass].length);\n assert(0 < this._commands[RenderPass.Hilite].length);\n\n let cmds = this._commands[this._forcedRenderPass];\n if (cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n\n cmds = this._commands[RenderPass.Hilite];\n if (cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n }\n }\n\n public pushAndPopBranch(branch: Branch, func: () => void): void {\n const animState = this.getAnimationBranchState(branch);\n if (animState?.omit)\n return;\n\n if (animState?.clip)\n this.pushAndPop(new PushClipCommand(animState.clip as ClipVolume), PopClipCommand.instance, () => this._pushAndPopBranch(branch, func));\n else\n this._pushAndPopBranch(branch, func);\n }\n\n private _pushAndPopBranch(branch: Branch, func: () => void): void {\n this._stack.pushBranch(branch);\n if (branch.planarClassifier)\n branch.planarClassifier.pushBatchState(this._batchState);\n\n if (branch.secondaryClassifiers)\n branch.secondaryClassifiers.forEach((classifier) => classifier.pushBatchState(this._batchState));\n\n this.pushAndPop(new PushBranchCommand(branch), PopBranchCommand.instance, func);\n\n this._stack.pop();\n }\n\n public pushAndPopState(state: BranchState, func: () => void): void {\n this._stack.pushState(state);\n this.pushAndPop(new PushStateCommand(state), PopBranchCommand.instance, func);\n this._stack.pop();\n }\n\n public clear(): void {\n assert(this._batchState.isEmpty);\n this._clearCommands();\n }\n\n private _clearCommands(): void {\n this._commands.forEach((cmds: DrawCommands) => cmds.splice(0));\n this._layers.clear();\n }\n\n private initForPickOverlayDecorations(overlays: GraphicList): void {\n for (const overlay of overlays) {\n const gf = overlay as Graphic;\n if (gf.isPickable)\n gf.addCommands(this);\n }\n }\n\n public initForPickOverlays(sceneOverlays: GraphicList, worldOverlayDecorations: GraphicList | undefined, viewOverlayDecorations: GraphicList | undefined): void {\n this._clearCommands();\n\n this._addTranslucentAsOpaque = true;\n\n for (const sceneGf of sceneOverlays)\n (sceneGf as Graphic).addCommands(this);\n\n if (worldOverlayDecorations?.length) {\n this.pushAndPopState(this.target.decorationsState, () => {\n this.initForPickOverlayDecorations(worldOverlayDecorations);\n });\n }\n\n if (viewOverlayDecorations?.length) {\n this.pushAndPopState(this.target.decorationsState.withViewCoords(), () => {\n this.initForPickOverlayDecorations(viewOverlayDecorations);\n });\n }\n\n this._addTranslucentAsOpaque = false;\n }\n\n public initForReadPixels(gfx: TargetGraphics): void {\n this.clear();\n\n // Set flag to force translucent geometry to be put into the opaque pass.\n this._addTranslucentAsOpaque = true;\n\n // Add the scene graphics.\n this.addGraphics(gfx.foreground);\n\n // Also add any pickable decorations.\n if (undefined !== gfx.decorations)\n this.addPickableDecorations(gfx.decorations);\n\n // Also background map is pickable\n this.addBackgroundMapGraphics(gfx.background);\n\n this._addTranslucentAsOpaque = false;\n\n this.setupClassificationByVolume();\n this._layers.outputCommands();\n }\n\n public initForRender(gfx: TargetGraphics): void {\n this.clear();\n\n this.addGraphics(gfx.foreground);\n this.addBackgroundMapGraphics(gfx.background);\n this.addOverlayGraphics(gfx.overlays);\n\n this.addGraphics(gfx.foregroundDynamics);\n this.addOverlayGraphics(gfx.overlayDynamics);\n\n const dec = gfx.decorations;\n if (undefined !== dec) {\n this.addBackground(dec.viewBackground as Graphic);\n\n this.addSkyBox(dec.skyBox as Graphic);\n\n if (undefined !== dec.normal && 0 < dec.normal.length)\n this.addGraphics(dec.normal);\n\n if (undefined !== dec.world && 0 < dec.world.length)\n this.addWorldDecorations(dec.world);\n\n this.pushAndPopState(this.target.decorationsState, () => {\n if (undefined !== dec.viewOverlay && 0 < dec.viewOverlay.length)\n this.addDecorations(dec.viewOverlay, RenderPass.ViewOverlay);\n\n if (undefined !== dec.worldOverlay && 0 < dec.worldOverlay.length)\n this.addDecorations(dec.worldOverlay, RenderPass.WorldOverlay);\n });\n }\n\n this.setupClassificationByVolume();\n this._layers.outputCommands();\n }\n\n public addPrimitive(prim: Primitive): void {\n // ###TODO Would be nice if we could detect outside active volume here, but active volume only applies to specific render passes\n // if (this.target.isGeometryOutsideActiveVolume(prim.cachedGeometry))\n // return;\n\n if (undefined !== this._frustumPlanes) { // See if we can cull this primitive.\n if (\"classification\" === prim.getPass(this.target)) {\n const geom = prim.cachedGeometry;\n geom.computeRange(this._scratchRange);\n let frustum = Frustum.fromRange(this._scratchRange, this._scratchFrustum);\n frustum = frustum.transformBy(this.target.currentTransform, frustum);\n if (FrustumPlanes.Containment.Outside === this._frustumPlanes.computeFrustumContainment(frustum)) {\n return;\n }\n }\n }\n\n const command = new PrimitiveCommand(prim);\n this.addPrimitiveCommand(command);\n\n if (RenderPass.None === this._forcedRenderPass && prim.isEdge) {\n const vf: ViewFlags = this.target.currentViewFlags;\n if (vf.renderMode !== RenderMode.Wireframe && vf.hiddenEdges)\n this.getCommands(RenderPass.HiddenEdge).push(command);\n }\n }\n\n public addBranch(branch: Branch): void {\n this.pushAndPopBranch(branch, () => {\n branch.branch.entries.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n });\n }\n\n public computeBatchHiliteRenderPass(batch: Batch): RenderPass {\n let pass = RenderPass.Hilite;\n if (batch.graphic instanceof MeshGraphic) {\n const mg = batch.graphic;\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n } else if (batch.graphic instanceof GraphicsArray) {\n const ga = batch.graphic;\n if (ga.graphics[0] instanceof MeshGraphic) {\n const mg = ga.graphics[0];\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n } else if (ga.graphics[0] instanceof Branch) {\n const b = ga.graphics[0];\n if (b.branch.entries.length > 0 && b.branch.entries[0] instanceof MeshGraphic) {\n const mg = b.branch.entries[0];\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n }\n }\n }\n return pass;\n }\n\n public addBatch(batch: Batch): void {\n if (batch.locateOnly && !this.target.isReadPixelsInProgress)\n return;\n\n // Batches (aka element tiles) should only draw during ordinary (translucent or opaque) passes.\n // They may draw during both, or neither.\n // NB: This is no longer true - pickable overlay decorations are defined as Batches. Problem?\n // assert(RenderPass.None === this._forcedRenderPass);\n assert(!this._opaqueOverrides && !this._translucentOverrides);\n assert(undefined === this._curBatch);\n\n // If all features are overridden to be invisible, draw no graphics in this batch\n const overrides = batch.getOverrides(this.target);\n if (overrides.allHidden)\n return;\n\n if (!batch.range.isNull) {\n // ###TODO Would be nice if we could detect outside active volume here, but active volume only applies to specific render passes\n // if (this.target.isRangeOutsideActiveVolume(batch.range))\n // return;\n\n if (undefined !== this._frustumPlanes) {\n let frustum = Frustum.fromRange(batch.range, this._scratchFrustum);\n frustum = frustum.transformBy(this.target.currentTransform, frustum);\n if (FrustumPlanes.Containment.Outside === this._frustumPlanes.computeFrustumContainment(frustum)) {\n return;\n }\n }\n }\n\n const classifier = this._stack.top.planarClassifier;\n\n this._batchState.push(batch, true);\n\n this.pushAndPop(new PushBatchCommand(batch), PopBatchCommand.instance, () => {\n if (this.currentViewFlags.transparency || overrides.anyViewIndependentTranslucent) {\n this._opaqueOverrides = overrides.anyOpaque;\n this._translucentOverrides = overrides.anyTranslucent;\n\n if (undefined !== classifier) {\n this._opaqueOverrides = this._opaqueOverrides || classifier.anyOpaque;\n this._translucentOverrides = this._translucentOverrides || classifier.anyTranslucent;\n }\n }\n\n // If we have an active volume classifier then force all batches for the reality data being classified into a special render pass.\n let savedForcedRenderPass = RenderPass.None;\n if (undefined !== this.target.activeVolumeClassifierModelId && batch.featureTable.batchModelId === this.target.activeVolumeClassifierModelId) {\n savedForcedRenderPass = this._forcedRenderPass;\n this._forcedRenderPass = RenderPass.VolumeClassifiedRealityData;\n }\n\n (batch.graphic as Graphic).addCommands(this);\n\n if (RenderPass.VolumeClassifiedRealityData === this._forcedRenderPass)\n this._forcedRenderPass = savedForcedRenderPass;\n\n // If the batch contains hilited features, need to render them in the hilite pass\n const anyHilited = overrides.anyHilited;\n const planarClassifierHilited = undefined !== classifier && classifier.anyHilited;\n if (anyHilited || planarClassifierHilited)\n (batch.graphic as Graphic).addHiliteCommands(this, planarClassifierHilited ? RenderPass.HilitePlanarClassification : this.computeBatchHiliteRenderPass(batch));\n\n });\n\n this._opaqueOverrides = this._translucentOverrides = false;\n this._batchState.pop();\n }\n\n // Define a culling frustum. Commands associated with Graphics whose ranges do not intersect the frustum will be skipped.\n public setCheckRange(frustum: Frustum) { this._frustumPlanes = FrustumPlanes.fromFrustum(frustum); }\n // Clear the culling frustum.\n public clearCheckRange(): void { this._frustumPlanes = undefined; }\n\n private setupClassificationByVolume(): void {\n // To make it easier to process the classifiers individually, set up a secondary command list for them where they\n // are each separated by their own pushes & pops so that they can easily be drawn individually. This now supports\n // nested branches and batches.\n const groupedCmds = this._commands[RenderPass.Classification];\n const byIndexCmds = this._commands[RenderPass.ClassificationByIndex];\n const pushCommands: DrawCommands = []; // will contain current set of pushes ahead of a primitive\n for (const cmd of groupedCmds) {\n switch (cmd.opcode) {\n case \"pushBranch\":\n case \"pushBatch\":\n case \"pushState\":\n pushCommands.push(cmd);\n break;\n case \"drawPrimitive\":\n for (const pushCmd of pushCommands) {\n byIndexCmds.push(pushCmd);\n }\n byIndexCmds.push(cmd);\n for (let i = pushCommands.length - 1; i >= 0; --i) {\n if (\"pushBatch\" === pushCommands[i].opcode)\n byIndexCmds.push(PopBatchCommand.instance);\n else // should be eith pushBranch or pushState opcode\n byIndexCmds.push(PopBranchCommand.instance);\n }\n break;\n case \"popBatch\":\n case \"popBranch\":\n pushCommands.pop();\n break;\n }\n }\n }\n\n public dump(): Array<{ name: string, count: number }> {\n const dump = [\n { name: \"Primitives\", count: 0 },\n { name: \"Batches\", count: 0 },\n { name: \"Branches\", count: 0 },\n ];\n\n for (const cmds of this._commands) {\n for (const cmd of cmds) {\n let index;\n switch (cmd.opcode) {\n case \"drawPrimitive\":\n index = 0;\n break;\n case \"pushBatch\":\n index = 1;\n break;\n case \"pushBranch\":\n index = 2;\n break;\n default:\n continue;\n }\n\n dump[index].count++;\n }\n }\n\n return dump;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RenderCommands.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/RenderCommands.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAA6B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAa,MAAM,oBAAoB,CAAC;AAE9G,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAM5E,OAAO,EACS,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAc,gBAAgB,EAAE,gBAAgB,EAC/G,iBAAiB,EAAE,eAAe,EAAe,gBAAgB,GAClE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAS,MAAM,EAAW,aAAa,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAkB,IAAI,EAA2B,MAAM,eAAe,CAAC;AAK9E;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,cAAc,CAAiB;IACtB,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,SAAS,GAAG,IAAI,KAAK,2BAAgC,CAAC;IAC/D,OAAO,CAAS;IAChB,MAAM,CAAc,CAAC,qCAAqC;IAC1D,WAAW,CAAa,CAAC,oCAAoC;IAC7D,iBAAiB,6BAA+B;IAChD,0BAA0B,GAAG,KAAK,CAAC;IACnC,gBAAgB,GAAG,KAAK,CAAC;IACzB,qBAAqB,GAAG,KAAK,CAAC;IAC9B,uBAAuB,GAAG,KAAK,CAAC,CAAC,6FAA6F;IACr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E,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE;YAC7B,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE;SAC/B,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAClC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,KAAK,CAAC;gBACV,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;oBACnB,KAAK,eAAe;wBAClB,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR,KAAK,WAAW;wBACd,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR,KAAK,YAAY;wBACf,KAAK,GAAG,CAAC,CAAC;wBACV,MAAM;oBACR;wBACE,SAAS;gBACb,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { FeatureAppearanceProvider, Frustum, FrustumPlanes, RenderMode, ViewFlags } from \"@itwin/core-common\";\nimport { Decorations } from \"../../../render/Decorations\";\nimport { SurfaceType } from \"../../../common/internal/render/SurfaceParams\";\nimport { GraphicList, RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { AnimationBranchState } from \"../AnimationBranchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchState } from \"./BranchState\";\nimport {\n DrawCommands, PopBatchCommand, PopBranchCommand, PopClipCommand, PopCommand, PrimitiveCommand, PushBatchCommand,\n PushBranchCommand, PushClipCommand, PushCommand, PushStateCommand,\n} from \"./DrawCommand\";\nimport { Batch, Branch, Graphic, GraphicsArray } from \"./Graphic\";\nimport { Layer, LayerContainer } from \"./Layer\";\nimport { LayerCommandLists } from \"./LayerCommands\";\nimport { MeshGraphic } from \"./Mesh\";\nimport { Primitive } from \"./Primitive\";\nimport { CompositeFlags, Pass, RenderOrder, RenderPass } from \"./RenderFlags\";\nimport { TargetGraphics } from \"./TargetGraphics\";\nimport { Target } from \"./Target\";\nimport { ClipVolume } from \"./ClipVolume\";\n\n/** A list of DrawCommands to be rendered, ordered by render pass.\n * @internal\n */\nexport class RenderCommands implements Iterable<DrawCommands> {\n private _frustumPlanes?: FrustumPlanes;\n private readonly _scratchFrustum = new Frustum();\n private readonly _scratchRange = new Range3d();\n private readonly _commands = new Array<DrawCommands>(RenderPass.COUNT);\n private _target: Target;\n private _stack: BranchStack; // refers to the Target's BranchStack\n private _batchState: BatchState; // refers to the Target's BatchState\n private _forcedRenderPass: RenderPass = RenderPass.None;\n private _addLayersAsNormalGraphics = false;\n private _opaqueOverrides = false;\n private _translucentOverrides = false;\n private _addTranslucentAsOpaque = false; // true when rendering for _ReadPixels to force translucent items to be drawn in opaque pass.\n private readonly _layers: LayerCommandLists;\n public appearanceProvider?: FeatureAppearanceProvider;\n\n public get target(): Target { return this._target; }\n\n public [Symbol.iterator](): Iterator<DrawCommands> {\n return this._commands[Symbol.iterator]();\n }\n\n public get isEmpty(): boolean {\n for (const commands of this._commands)\n if (0 < commands.length)\n return false;\n\n return true;\n }\n\n public get isDrawingLayers() {\n switch (this._forcedRenderPass) {\n case RenderPass.OpaqueLayers:\n case RenderPass.TranslucentLayers:\n case RenderPass.OverlayLayers:\n return true;\n default:\n return false;\n }\n }\n\n public get currentViewFlags(): ViewFlags { return this._stack.top.viewFlags; }\n public get compositeFlags(): CompositeFlags {\n let flags = CompositeFlags.None;\n if (this.hasCommands(RenderPass.Translucent))\n flags |= CompositeFlags.Translucent;\n\n if (this.hasCommands(RenderPass.Hilite) || this.hasCommands(RenderPass.HiliteClassification) || this.hasCommands(RenderPass.HilitePlanarClassification))\n flags |= CompositeFlags.Hilite;\n\n if (this.target.wantAmbientOcclusion)\n flags |= CompositeFlags.AmbientOcclusion;\n\n return flags;\n }\n\n private get _curBatch(): Batch | undefined { return this._batchState.currentBatch; }\n\n public hasCommands(pass: RenderPass): boolean { return 0 !== this.getCommands(pass).length; }\n public isOpaquePass(pass: RenderPass): boolean { return pass >= RenderPass.OpaqueLinear && pass <= RenderPass.OpaqueGeneral; }\n\n constructor(target: Target, stack: BranchStack, batchState: BatchState) {\n this._target = target;\n this._stack = stack;\n this._batchState = batchState;\n this._layers = new LayerCommandLists(this);\n\n for (let i = 0; i < RenderPass.COUNT; ++i)\n this._commands[i] = [];\n }\n\n public reset(target: Target, stack: BranchStack, batchState: BatchState): void {\n this._target = target;\n this._stack = stack;\n this._batchState = batchState;\n this.appearanceProvider = undefined;\n this.clear();\n }\n\n public collectGraphicsForPlanarProjection(scene: GraphicList): void {\n assert(this._forcedRenderPass === RenderPass.None);\n assert(!this._addLayersAsNormalGraphics);\n\n this._addLayersAsNormalGraphics = true;\n this.addGraphics(scene);\n this._addLayersAsNormalGraphics = false;\n }\n\n public addGraphics(scene: GraphicList, forcedPass: RenderPass = RenderPass.None): void {\n this._forcedRenderPass = forcedPass;\n scene.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n /** Add backgroundMap graphics to their own render pass. */\n public addBackgroundMapGraphics(backgroundMapGraphics: GraphicList): void {\n this._forcedRenderPass = RenderPass.BackgroundMap;\n backgroundMapGraphics.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n /** Add overlay graphics to the world overlay pass */\n public addOverlayGraphics(overlayGraphics: GraphicList): void {\n this._forcedRenderPass = RenderPass.WorldOverlay;\n overlayGraphics.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addDecorations(dec: GraphicList, forcedPass: RenderPass = RenderPass.None): void {\n this._forcedRenderPass = forcedPass;\n for (const entry of dec) {\n (entry as Graphic).addCommands(this);\n }\n\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addWorldDecorations(decs: GraphicList): void {\n const world = this.target.getWorldDecorations(decs);\n this.pushAndPopBranch(world, () => {\n for (const entry of world.branch.entries) {\n (entry as Graphic).addCommands(this);\n }\n });\n }\n\n private addPickableDecorations(decs: Decorations): void {\n if (undefined !== decs.normal) {\n for (const normal of decs.normal) {\n const gf = normal as Graphic;\n if (gf.isPickable)\n gf.addCommands(this);\n }\n }\n\n if (undefined !== decs.world) {\n const world = this.target.getWorldDecorations(decs.world);\n this.pushAndPopBranch(world, () => {\n for (const gf of world.branch.entries) {\n if ((gf as Graphic).isPickable)\n (gf as Graphic).addCommands(this);\n }\n });\n }\n }\n\n public addBackground(gf?: Graphic): void {\n if (undefined === gf)\n return;\n\n assert(RenderPass.None === this._forcedRenderPass);\n\n this._forcedRenderPass = RenderPass.Background;\n this.pushAndPopState(this.target.decorationsState, () => gf.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addSkyBox(gf?: Graphic): void {\n if (undefined === gf)\n return;\n\n assert(RenderPass.None === this._forcedRenderPass);\n\n this._forcedRenderPass = RenderPass.SkyBox;\n this.pushAndPopState(this.target.decorationsState, () => gf.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addPrimitiveCommand(command: PrimitiveCommand, pass?: Pass): void {\n if (undefined === pass)\n pass = command.getPass(this.target);\n\n if (\"none\" === pass) // Edges will return none if they don't want to draw at all (edges not turned on).\n return;\n\n if (RenderPass.None !== this._forcedRenderPass) {\n // Add the command to the forced render pass (background).\n this.getCommands(this._forcedRenderPass).push(command);\n return;\n }\n\n if (!command.hasFeatures) {\n // Draw in general opaque pass so they are not in pick data.\n switch (pass) {\n case \"opaque-linear\":\n case \"opaque-planar\":\n pass = \"opaque\";\n break;\n case \"opaque-planar-translucent\":\n pass = \"opaque-translucent\";\n break;\n }\n }\n\n const haveFeatureOverrides = (this._opaqueOverrides || this._translucentOverrides) && command.opcode && command.hasFeatures;\n\n if (Pass.rendersTranslucent(pass) && this._addTranslucentAsOpaque) {\n switch (command.renderOrder) {\n case RenderOrder.PlanarLitSurface:\n case RenderOrder.PlanarUnlitSurface:\n case RenderOrder.BlankingRegion:\n pass = \"opaque-planar\";\n break;\n case RenderOrder.LitSurface:\n case RenderOrder.UnlitSurface:\n pass = \"opaque\";\n break;\n default:\n pass = \"opaque-linear\";\n break;\n }\n }\n\n const isDoublePass = Pass.rendersOpaqueAndTranslucent(pass);\n const renderTranslucentDuringOpaque = isDoublePass || (this._opaqueOverrides && haveFeatureOverrides);\n if (renderTranslucentDuringOpaque && Pass.rendersTranslucent(pass) && !command.primitive.cachedGeometry.alwaysRenderTranslucent) {\n let opaquePass: RenderPass;\n if (Pass.rendersOpaqueAndTranslucent(pass)) {\n opaquePass = Pass.toOpaquePass(pass);\n } else {\n switch (command.renderOrder) {\n case RenderOrder.PlanarLitSurface:\n case RenderOrder.PlanarUnlitSurface:\n case RenderOrder.BlankingRegion:\n opaquePass = RenderPass.OpaquePlanar;\n break;\n case RenderOrder.LitSurface:\n case RenderOrder.UnlitSurface:\n opaquePass = RenderPass.OpaqueGeneral;\n break;\n default:\n opaquePass = RenderPass.OpaqueLinear;\n break;\n }\n }\n\n this.getCommands(opaquePass).push(command);\n }\n\n const renderOpaqueDuringTranslucent = isDoublePass || (this._translucentOverrides && haveFeatureOverrides);\n if (renderOpaqueDuringTranslucent && Pass.rendersOpaque(pass) && !this._addTranslucentAsOpaque)\n this.getCommands(RenderPass.Translucent).push(command);\n\n if (!Pass.rendersOpaqueAndTranslucent(pass))\n this.getCommands(Pass.toRenderPass(pass)).push(command);\n }\n\n public getCommands(pass: RenderPass): DrawCommands {\n let idx = pass as number;\n assert(idx < this._commands.length);\n if (idx >= this._commands.length)\n idx -= 1;\n\n return this._commands[idx];\n }\n\n public replaceCommands(pass: RenderPass, cmds: DrawCommands): void {\n const idx = pass as number;\n this._commands[idx].splice(0);\n this._commands[idx] = cmds;\n }\n\n public addHiliteBranch(branch: Branch, pass: RenderPass): void {\n this.pushAndPopBranchForPass(pass, branch, () => {\n branch.branch.entries.forEach((entry: RenderGraphic) => (entry as Graphic).addHiliteCommands(this, pass));\n });\n }\n\n public processLayers(container: LayerContainer): void {\n assert(RenderPass.None === this._forcedRenderPass);\n if (RenderPass.None !== this._forcedRenderPass)\n return;\n\n this._forcedRenderPass = container.renderPass;\n this._layers.processLayers(container, () => container.graphic.addCommands(this));\n this._forcedRenderPass = RenderPass.None;\n }\n\n public addLayerCommands(layer: Layer): void {\n if (this._addLayersAsNormalGraphics) {\n // GraphicsCollectorDrawArgs wants to collect graphics to project to a plane for masking.\n // It bypasses PlanProjectionTreeReference.createDrawArgs which would otherwise wrap the graphics in a LayerContainer.\n assert(this._forcedRenderPass === RenderPass.None);\n this._forcedRenderPass = RenderPass.OpaqueGeneral;\n layer.graphic.addCommands(this);\n this._forcedRenderPass = RenderPass.None;\n return;\n }\n\n assert(this.isDrawingLayers);\n if (!this.isDrawingLayers)\n return;\n\n // Let the graphic add its commands. Afterward, pull them out and add them to the LayerCommands.\n this._layers.currentLayer = layer;\n layer.graphic.addCommands(this);\n\n const cmds = this.getCommands(this._forcedRenderPass);\n this._layers.addCommands(cmds);\n\n cmds.length = 0;\n this._layers.currentLayer = undefined;\n }\n\n public addHiliteLayerCommands(graphic: Graphic, pass: RenderPass): void {\n assert(this.isDrawingLayers || this._addLayersAsNormalGraphics);\n if (!this.isDrawingLayers && !this._addLayersAsNormalGraphics)\n return;\n\n const prevPass = this._forcedRenderPass;\n this._forcedRenderPass = RenderPass.None;\n\n graphic.addHiliteCommands(this, pass);\n\n this._forcedRenderPass = prevPass;\n }\n\n private getAnimationBranchState(branch: Branch): AnimationBranchState | undefined {\n const animId = branch.branch.animationId;\n return undefined !== animId ? this.target.animationBranches?.branchStates.get(animId) : undefined;\n }\n\n private pushAndPopBranchForPass(pass: RenderPass, branch: Branch, func: () => void): void {\n assert(!this.isDrawingLayers);\n\n const animState = this.getAnimationBranchState(branch);\n if (animState?.omit)\n return;\n\n assert(RenderPass.None !== pass);\n\n this._stack.pushBranch(branch);\n if (branch.planarClassifier)\n branch.planarClassifier.pushBatchState(this._batchState);\n\n if (branch.secondaryClassifiers)\n branch.secondaryClassifiers.forEach((classifier) => classifier.pushBatchState(this._batchState));\n\n const cmds = this.getCommands(pass);\n const clip = animState?.clip as ClipVolume | undefined;\n const pushClip = undefined !== clip ? new PushClipCommand(clip) : undefined;\n if (pushClip)\n cmds.push(pushClip);\n\n const push = new PushBranchCommand(branch);\n cmds.push(push);\n\n func();\n\n this._stack.pop();\n if (cmds[cmds.length - 1] === push) {\n cmds.pop();\n if (pushClip)\n cmds.pop();\n } else {\n cmds.push(PopBranchCommand.instance);\n if (pushClip)\n cmds.push(PopClipCommand.instance);\n }\n }\n\n private pushAndPop(push: PushCommand, pop: PopCommand, func: () => void): void {\n if (this.isDrawingLayers) {\n this._commands[RenderPass.Hilite].push(push);\n this._layers.pushAndPop(push, pop, func);\n\n const cmds = this._commands[RenderPass.Hilite];\n if (0 < cmds.length && cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n\n return;\n }\n\n if (RenderPass.None === this._forcedRenderPass) {\n // Need to make sure the push command precedes any subsequent commands added to any render pass.\n for (const cmds of this._commands)\n cmds.push(push);\n } else {\n // May want to add hilite commands as well - add the push command to that pass.\n this._commands[this._forcedRenderPass].push(push);\n this._commands[RenderPass.Hilite].push(push);\n }\n\n func();\n\n // Remove push command from any passes that didn't receive any commands; add the pop command to any passes that did.\n if (RenderPass.None === this._forcedRenderPass) {\n for (const cmds of this._commands) {\n assert(0 < cmds.length);\n if (0 < cmds.length && cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n }\n } else {\n assert(0 < this._commands[this._forcedRenderPass].length);\n assert(0 < this._commands[RenderPass.Hilite].length);\n\n let cmds = this._commands[this._forcedRenderPass];\n if (cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n\n cmds = this._commands[RenderPass.Hilite];\n if (cmds[cmds.length - 1] === push)\n cmds.pop();\n else\n cmds.push(pop);\n }\n }\n\n public pushAndPopBranch(branch: Branch, func: () => void): void {\n const animState = this.getAnimationBranchState(branch);\n if (animState?.omit)\n return;\n\n if (animState?.clip)\n this.pushAndPop(new PushClipCommand(animState.clip as ClipVolume), PopClipCommand.instance, () => this._pushAndPopBranch(branch, func));\n else\n this._pushAndPopBranch(branch, func);\n }\n\n private _pushAndPopBranch(branch: Branch, func: () => void): void {\n this._stack.pushBranch(branch);\n if (branch.planarClassifier)\n branch.planarClassifier.pushBatchState(this._batchState);\n\n if (branch.secondaryClassifiers)\n branch.secondaryClassifiers.forEach((classifier) => classifier.pushBatchState(this._batchState));\n\n this.pushAndPop(new PushBranchCommand(branch), PopBranchCommand.instance, func);\n\n this._stack.pop();\n }\n\n public pushAndPopState(state: BranchState, func: () => void): void {\n this._stack.pushState(state);\n this.pushAndPop(new PushStateCommand(state), PopBranchCommand.instance, func);\n this._stack.pop();\n }\n\n public clear(): void {\n assert(this._batchState.isEmpty);\n this._clearCommands();\n }\n\n private _clearCommands(): void {\n this._commands.forEach((cmds: DrawCommands) => cmds.splice(0));\n this._layers.clear();\n }\n\n private initForPickOverlayDecorations(overlays: GraphicList): void {\n for (const overlay of overlays) {\n const gf = overlay as Graphic;\n if (gf.isPickable)\n gf.addCommands(this);\n }\n }\n\n public initForPickOverlays(sceneOverlays: GraphicList, worldOverlayDecorations: GraphicList | undefined, viewOverlayDecorations: GraphicList | undefined): void {\n this._clearCommands();\n\n this._addTranslucentAsOpaque = true;\n\n for (const sceneGf of sceneOverlays)\n (sceneGf as Graphic).addCommands(this);\n\n if (worldOverlayDecorations?.length) {\n this.pushAndPopState(this.target.decorationsState, () => {\n this.initForPickOverlayDecorations(worldOverlayDecorations);\n });\n }\n\n if (viewOverlayDecorations?.length) {\n this.pushAndPopState(this.target.decorationsState.withViewCoords(), () => {\n this.initForPickOverlayDecorations(viewOverlayDecorations);\n });\n }\n\n this._addTranslucentAsOpaque = false;\n }\n\n public initForReadPixels(gfx: TargetGraphics): void {\n this.clear();\n\n // Set flag to force translucent geometry to be put into the opaque pass.\n this._addTranslucentAsOpaque = true;\n\n // Add the scene graphics.\n this.addGraphics(gfx.foreground);\n\n // Also add any pickable decorations.\n if (undefined !== gfx.decorations)\n this.addPickableDecorations(gfx.decorations);\n\n // Also background map is pickable\n this.addBackgroundMapGraphics(gfx.background);\n\n this._addTranslucentAsOpaque = false;\n\n this.setupClassificationByVolume();\n this._layers.outputCommands();\n }\n\n public initForRender(gfx: TargetGraphics): void {\n this.clear();\n\n this.addGraphics(gfx.foreground);\n this.addBackgroundMapGraphics(gfx.background);\n this.addOverlayGraphics(gfx.overlays);\n\n this.addGraphics(gfx.foregroundDynamics);\n this.addOverlayGraphics(gfx.overlayDynamics);\n\n const dec = gfx.decorations;\n if (undefined !== dec) {\n this.addBackground(dec.viewBackground as Graphic);\n\n this.addSkyBox(dec.skyBox as Graphic);\n\n if (undefined !== dec.normal && 0 < dec.normal.length)\n this.addGraphics(dec.normal);\n\n if (undefined !== dec.world && 0 < dec.world.length)\n this.addWorldDecorations(dec.world);\n\n this.pushAndPopState(this.target.decorationsState, () => {\n if (undefined !== dec.viewOverlay && 0 < dec.viewOverlay.length)\n this.addDecorations(dec.viewOverlay, RenderPass.ViewOverlay);\n\n if (undefined !== dec.worldOverlay && 0 < dec.worldOverlay.length)\n this.addDecorations(dec.worldOverlay, RenderPass.WorldOverlay);\n });\n }\n\n this.setupClassificationByVolume();\n this._layers.outputCommands();\n }\n\n public addPrimitive(prim: Primitive): void {\n // ###TODO Would be nice if we could detect outside active volume here, but active volume only applies to specific render passes\n // if (this.target.isGeometryOutsideActiveVolume(prim.cachedGeometry))\n // return;\n\n if (undefined !== this._frustumPlanes) { // See if we can cull this primitive.\n if (\"classification\" === prim.getPass(this.target)) {\n const geom = prim.cachedGeometry;\n geom.computeRange(this._scratchRange);\n let frustum = Frustum.fromRange(this._scratchRange, this._scratchFrustum);\n frustum = frustum.transformBy(this.target.currentTransform, frustum);\n if (FrustumPlanes.Containment.Outside === this._frustumPlanes.computeFrustumContainment(frustum)) {\n return;\n }\n }\n }\n\n const command = new PrimitiveCommand(prim);\n this.addPrimitiveCommand(command);\n\n if (RenderPass.None === this._forcedRenderPass && prim.isEdge) {\n const vf: ViewFlags = this.target.currentViewFlags;\n if (vf.renderMode !== RenderMode.Wireframe && vf.hiddenEdges)\n this.getCommands(RenderPass.HiddenEdge).push(command);\n }\n }\n\n public addBranch(branch: Branch): void {\n this.pushAndPopBranch(branch, () => {\n branch.branch.entries.forEach((entry: RenderGraphic) => (entry as Graphic).addCommands(this));\n });\n }\n\n public computeBatchHiliteRenderPass(batch: Batch): RenderPass {\n let pass = RenderPass.Hilite;\n if (batch.graphic instanceof MeshGraphic) {\n const mg = batch.graphic;\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n } else if (batch.graphic instanceof GraphicsArray) {\n const ga = batch.graphic;\n if (ga.graphics[0] instanceof MeshGraphic) {\n const mg = ga.graphics[0];\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n } else if (ga.graphics[0] instanceof Branch) {\n const b = ga.graphics[0];\n if (b.branch.entries.length > 0 && b.branch.entries[0] instanceof MeshGraphic) {\n const mg = b.branch.entries[0];\n if (SurfaceType.VolumeClassifier === mg.surfaceType)\n pass = RenderPass.HiliteClassification;\n }\n }\n }\n return pass;\n }\n\n public addBatch(batch: Batch): void {\n if (batch.locateOnly && !this.target.isReadPixelsInProgress)\n return;\n\n // Batches (aka element tiles) should only draw during ordinary (translucent or opaque) passes.\n // They may draw during both, or neither.\n // NB: This is no longer true - pickable overlay decorations are defined as Batches. Problem?\n // assert(RenderPass.None === this._forcedRenderPass);\n assert(!this._opaqueOverrides && !this._translucentOverrides);\n assert(undefined === this._curBatch);\n\n // If all features are overridden to be invisible, draw no graphics in this batch\n const overrides = batch.getOverrides(this.target, this.appearanceProvider ?? this._stack.top);\n if (overrides.allHidden)\n return;\n\n if (!batch.range.isNull) {\n // ###TODO Would be nice if we could detect outside active volume here, but active volume only applies to specific render passes\n // if (this.target.isRangeOutsideActiveVolume(batch.range))\n // return;\n\n if (undefined !== this._frustumPlanes) {\n let frustum = Frustum.fromRange(batch.range, this._scratchFrustum);\n frustum = frustum.transformBy(this.target.currentTransform, frustum);\n if (FrustumPlanes.Containment.Outside === this._frustumPlanes.computeFrustumContainment(frustum)) {\n return;\n }\n }\n }\n\n const classifier = this._stack.top.planarClassifier;\n\n this._batchState.push(batch, true);\n\n this.pushAndPop(new PushBatchCommand(batch), PopBatchCommand.instance, () => {\n if (this.currentViewFlags.transparency || overrides.anyViewIndependentTranslucent) {\n this._opaqueOverrides = overrides.anyOpaque;\n this._translucentOverrides = overrides.anyTranslucent;\n\n if (undefined !== classifier) {\n this._opaqueOverrides = this._opaqueOverrides || classifier.anyOpaque;\n this._translucentOverrides = this._translucentOverrides || classifier.anyTranslucent;\n }\n }\n\n // If we have an active volume classifier then force all batches for the reality data being classified into a special render pass.\n let savedForcedRenderPass = RenderPass.None;\n if (undefined !== this.target.activeVolumeClassifierModelId && batch.featureTable.batchModelId === this.target.activeVolumeClassifierModelId) {\n savedForcedRenderPass = this._forcedRenderPass;\n this._forcedRenderPass = RenderPass.VolumeClassifiedRealityData;\n }\n\n (batch.graphic as Graphic).addCommands(this);\n\n if (RenderPass.VolumeClassifiedRealityData === this._forcedRenderPass)\n this._forcedRenderPass = savedForcedRenderPass;\n\n // If the batch contains hilited features, need to render them in the hilite pass\n const anyHilited = overrides.anyHilited;\n const planarClassifierHilited = undefined !== classifier && classifier.anyHilited;\n if (anyHilited || planarClassifierHilited)\n (batch.graphic as Graphic).addHiliteCommands(this, planarClassifierHilited ? RenderPass.HilitePlanarClassification : this.computeBatchHiliteRenderPass(batch));\n\n });\n\n this._opaqueOverrides = this._translucentOverrides = false;\n this._batchState.pop();\n }\n\n // Define a culling frustum. Commands associated with Graphics whose ranges do not intersect the frustum will be skipped.\n public setCheckRange(frustum: Frustum) { this._frustumPlanes = FrustumPlanes.fromFrustum(frustum); }\n // Clear the culling frustum.\n public clearCheckRange(): void { this._frustumPlanes = undefined; }\n\n private setupClassificationByVolume(): void {\n // To make it easier to process the classifiers individually, set up a secondary command list for them where they\n // are each separated by their own pushes & pops so that they can easily be drawn individually. This now supports\n // nested branches and batches.\n const groupedCmds = this._commands[RenderPass.Classification];\n const byIndexCmds = this._commands[RenderPass.ClassificationByIndex];\n const pushCommands: DrawCommands = []; // will contain current set of pushes ahead of a primitive\n for (const cmd of groupedCmds) {\n switch (cmd.opcode) {\n case \"pushBranch\":\n case \"pushBatch\":\n case \"pushState\":\n pushCommands.push(cmd);\n break;\n case \"drawPrimitive\":\n for (const pushCmd of pushCommands) {\n byIndexCmds.push(pushCmd);\n }\n byIndexCmds.push(cmd);\n for (let i = pushCommands.length - 1; i >= 0; --i) {\n if (\"pushBatch\" === pushCommands[i].opcode)\n byIndexCmds.push(PopBatchCommand.instance);\n else // should be eith pushBranch or pushState opcode\n byIndexCmds.push(PopBranchCommand.instance);\n }\n break;\n case \"popBatch\":\n case \"popBranch\":\n pushCommands.pop();\n break;\n }\n }\n }\n\n public dump(): Array<{ name: string, count: number }> {\n const dump = [\n { name: \"Primitives\", count: 0 },\n { name: \"Batches\", count: 0 },\n { name: \"Branches\", count: 0 },\n ];\n\n for (const cmds of this._commands) {\n for (const cmd of cmds) {\n let index;\n switch (cmd.opcode) {\n case \"drawPrimitive\":\n index = 0;\n break;\n case \"pushBatch\":\n index = 1;\n break;\n case \"pushBranch\":\n index = 2;\n break;\n default:\n continue;\n }\n\n dump[index].count++;\n }\n }\n\n return dump;\n }\n}\n"]}
|
|
@@ -286,10 +286,10 @@ export class Target extends RenderTarget {
|
|
|
286
286
|
return this.isRangeOutsideActiveVolume(range);
|
|
287
287
|
}
|
|
288
288
|
pushBatch(batch) {
|
|
289
|
-
this.uniforms.batch.setCurrentBatch(batch);
|
|
289
|
+
this.uniforms.batch.setCurrentBatch(batch, this.currentBranch);
|
|
290
290
|
}
|
|
291
291
|
popBatch() {
|
|
292
|
-
this.uniforms.batch.
|
|
292
|
+
this.uniforms.batch.clearCurrentBatch();
|
|
293
293
|
}
|
|
294
294
|
addBatch(batch) {
|
|
295
295
|
assert(this._batches.indexOf(batch) < 0);
|